common/mixins.py
changeset 189 46fea7075866
parent 173 a4a9e1a7e40f
child 361 5cd8bc047b52
--- a/common/mixins.py	Mon Dec 08 08:15:39 2008 -0800
+++ b/common/mixins.py	Mon Dec 08 08:18:27 2008 -0800
@@ -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.