Changeset bc798fc for remit/finance_core/models.py
- Timestamp:
- Apr 18, 2010, 4:58:22 PM (15 years ago)
- Branches:
- master, client
- Children:
- 074fac7
- Parents:
- 5a72e32
- git-author:
- Alex Dehnert <adehnert@…> (04/18/10 16:58:22)
- git-committer:
- Alex Dehnert <adehnert@…> (04/18/10 16:58:22)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
remit/finance_core/models.py
r5a72e32 rbc798fc 56 56 57 57 @classmethod 58 def get_by_path(cls, path): 59 try: 60 root = BudgetArea.objects.get(name=path[0], depth=1) 61 except IndexError, e: 62 raise KeyError(e) 63 node = root 64 for name in path[1:]: 58 def get_by_path(cls, path, base=None, ): 59 if base: 60 node = base 61 else: 62 try: 63 root = BudgetArea.objects.get(name=path[0], depth=1) 64 except IndexError, e: 65 raise KeyError(e) 66 node = root 67 path = path[1:] 68 for name in path: 65 69 try: 66 70 node = node.get_children().filter(name=name)[0] … … 70 74 71 75 @classmethod 72 def get_by_pathstr(cls, path ):76 def get_by_pathstr(cls, path, base=None): 73 77 path = path.split('.') 74 return cls.get_by_path(path )78 return cls.get_by_path(path, base=base, ) 75 79 76 80 def pathstr(self, skip=0):
Note: See TracChangeset
for help on using the changeset viewer.