Commit 0106b6fe by benjaoming

python 2.5 support

parent b86be8c0
...@@ -52,8 +52,7 @@ class URLPath(MPTTModel): ...@@ -52,8 +52,7 @@ class URLPath(MPTTModel):
#self._tree_manager = URLPath.objects #self._tree_manager = URLPath.objects
return super(URLPath, self).__init__(*args, **kwargs) return super(URLPath, self).__init__(*args, **kwargs)
@property def __cached_ancestors(self):
def cached_ancestors(self):
""" """
This returns the ancestors of this urlpath. These ancestors are hopefully This returns the ancestors of this urlpath. These ancestors are hopefully
cached from the article path lookup. Accessing a foreign key included in cached from the article path lookup. Accessing a foreign key included in
...@@ -70,10 +69,13 @@ class URLPath(MPTTModel): ...@@ -70,10 +69,13 @@ class URLPath(MPTTModel):
return self._cached_ancestors return self._cached_ancestors
@cached_ancestors.setter def __cached_ancestors_setter(self, ancestors):
def cached_ancestors(self, ancestors):
self._cached_ancestors = ancestors self._cached_ancestors = ancestors
# Python 2.5 compatible property constructor
cached_ancestors = property(__cached_ancestors,
__cached_ancestors_setter)
def set_cached_ancestors_from_parent(self, parent): def set_cached_ancestors_from_parent(self, parent):
self.cached_ancestors = parent.cached_ancestors + [parent] self.cached_ancestors = parent.cached_ancestors + [parent]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment