Minor changes to penfield to return feed urls only when feeds are actually enabled...
[philo.git] / models / base.py
index 0598407..34e90dc 100644 (file)
@@ -358,6 +358,8 @@ class TreeManager(models.Manager):
                                
                                if deepest_level == depth:
                                        # This should happen if nothing is found with any part of the given path.
+                                       if root is not None:
+                                               return root, build_path(segments)
                                        raise
                                
                                return find_obj(segments, depth, deepest_found)
@@ -402,6 +404,9 @@ class TreeModel(MPTTModel):
        slug = models.SlugField(max_length=255)
        
        def get_path(self, root=None, pathsep='/', field='slug'):
+               if root == self:
+                       return ''
+               
                if root is not None and not self.is_descendant_of(root):
                        raise AncestorDoesNotExist(root)