common/mixins.py
changeset 173 a4a9e1a7e40f
parent 62 ef06f71533d9
child 361 5cd8bc047b52
--- 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.