git.ithinksw.org
/
philo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
83c66d9
)
Fixing a bug whereby get_path on TreeModel and Node subclasses failed if the field...
author
Joseph Spiros
<joseph.spiros@ithinksw.com>
Wed, 19 May 2010 09:41:32 +0000
(
05:41
-0400)
committer
Joseph Spiros
<joseph.spiros@ithinksw.com>
Wed, 19 May 2010 09:41:32 +0000
(
05:41
-0400)
models.py
patch
|
blob
|
history
diff --git
a/models.py
b/models.py
index
1d255c7
..
64cf769
100644
(file)
--- a/
models.py
+++ b/
models.py
@@
-163,10
+163,10
@@
class TreeModel(models.Model):
slug = models.SlugField()
def get_path(self, pathsep='/', field='slug'):
slug = models.SlugField()
def get_path(self, pathsep='/', field='slug'):
- path = getattr(self, field)
+ path = getattr(self, field
, '?'
)
parent = self.parent
while parent:
parent = self.parent
while parent:
- path = getattr(parent, field) + pathsep + path
+ path = getattr(parent, field
, '?'
) + pathsep + path
parent = parent.parent
return path
path = property(get_path)
parent = parent.parent
return path
path = property(get_path)
@@
-199,10
+199,10
@@
class Node(TreeEntity):
instance_type = models.ForeignKey(ContentType, editable=False)
def get_path(self, pathsep='/', field='slug'):
instance_type = models.ForeignKey(ContentType, editable=False)
def get_path(self, pathsep='/', field='slug'):
- path = getattr(self.instance, field)
+ path = getattr(self.instance, field
, '?'
)
parent = self.parent
while parent:
parent = self.parent
while parent:
- path = getattr(parent.instance, field) + pathsep + path
+ path = getattr(parent.instance, field
, '?'
) + pathsep + path
parent = parent.parent
return path
path = property(get_path)
parent = parent.parent
return path
path = property(get_path)