better as a method of the etypes registry
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 13 Aug 2009 12:18:55 +0200
changeset 2824 3455f72010fe
parent 2823 a4e3e9b1a9cd
child 2825 87ac03aed941
better as a method of the etypes registry
cwvreg.py
entity.py
--- a/cwvreg.py	Thu Aug 13 12:18:37 2009 +0200
+++ b/cwvreg.py	Thu Aug 13 12:18:55 2009 +0200
@@ -105,6 +105,13 @@
         super(ETypeRegistry, self).register(obj, **kwargs)
 
     @cached
+    def parent_classes(self, etype):
+        eschema = self.schema.eschema(etype)
+        parents = [cls.etype_class(e.type) for e in eschema.ancestors()]
+        parents.append(self.etype_class('Any'))
+        return parents
+
+    @cached
     def etype_class(self, etype):
         """return an entity class for the given entity type.
 
--- a/entity.py	Thu Aug 13 12:18:37 2009 +0200
+++ b/entity.py	Thu Aug 13 12:18:55 2009 +0200
@@ -267,14 +267,6 @@
 
     @classmethod
     @cached
-    def parent_classes(cls):
-        parents = [cls.vreg['etypes'].etype_class(e.type)
-                   for e in cls.e_schema.ancestors()]
-        parents.append(cls.vreg['etypes'].etype_class('Any'))
-        return parents
-
-    @classmethod
-    @cached
     def _rest_attr_info(cls):
         mainattr, needcheck = 'eid', True
         if cls.rest_attr: