# HG changeset patch # User Aurelien Campeas # Date 1228474263 -3600 # Node ID a4a9e1a7e40f07a2131a64e82c3aae1f6eb71002 # Parent bed4bc2e0a2fffdb411e57a29a8aca0f0ea089c5 TreeMixin : provide an iterator on the parents diff -r bed4bc2e0a2f -r a4a9e1a7e40f common/mixins.py --- a/common/mixins.py Tue Dec 02 19:25:59 2008 +0100 +++ b/common/mixins.py Fri Dec 05 11:51:03 2008 +0100 @@ -95,6 +95,16 @@ path.reverse() return path + def iterparents(self): + def _uptoroot(self): + curr = self + while True: + curr = curr.parent() + if curr is None: + break + yield curr + return _uptoroot(self) + def notification_references(self, view): """used to control References field of email send on notification for this entity. `view` is the notification view.