new parent_classes method (cached) tls-sprint
authorsylvain.thenault@logilab.fr
Fri, 24 Apr 2009 15:37:05 +0200
branchtls-sprint
changeset 1471 c889c3bcf5ec
parent 1470 fbdf66a08fbb
child 1472 96e06e623494
new parent_classes method (cached)
entity.py
--- a/entity.py	Fri Apr 24 09:56:19 2009 +0200
+++ b/entity.py	Fri Apr 24 15:37:05 2009 +0200
@@ -59,7 +59,7 @@
                 AutomaticEntityForm.rinlined.set_rtag(True, rtype, role, stype, otype)
             else:
                 raise ValueError(tag)
-            
+
 except ImportError:
     AutomaticEntityForm = None
     
@@ -277,6 +277,13 @@
                 orderby.append(orderterm)
         return selection, orderby, restrictions
 
+    @classmethod
+    @cached
+    def parent_classes(cls):
+        parents = [cls.vreg.etype_class(e.type) for e in cls.e_schema.ancestors()]
+        parents.append(cls.vreg.etype_class('Any'))
+        return parents
+
     def __init__(self, req, rset=None, row=None, col=0):
         AppRsetObject.__init__(self, req, rset, row, col)
         dict.__init__(self)