__initialize__ needs the schema as argument
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 13 Aug 2009 10:50:19 +0200
changeset 2807 696ff03f9a58
parent 2806 9d7173656a1a
child 2808 497424219fb0
__initialize__ needs the schema as argument
cwvreg.py
entity.py
--- a/cwvreg.py	Thu Aug 13 10:49:46 2009 +0200
+++ b/cwvreg.py	Thu Aug 13 10:50:19 2009 +0200
@@ -136,11 +136,11 @@
             assert len(objects) == 1, objects
             cls = objects[0]
         if cls.id == etype:
-            cls.__initialize__()
+            cls.__initialize__(self.schema)
             return cls
         cls = dump_class(cls, etype)
         cls.id = etype
-        cls.__initialize__()
+        cls.__initialize__(self.schema)
         return cls
 
 VRegistry.REGISTRY_FACTORY['etypes'] = ETypeRegistry
--- a/entity.py	Thu Aug 13 10:49:46 2009 +0200
+++ b/entity.py	Thu Aug 13 10:50:19 2009 +0200
@@ -170,13 +170,13 @@
     MODE_TAGS = set(('link', 'create'))
     CATEGORY_TAGS = set(('primary', 'secondary', 'generic', 'generated')) # , 'metadata'))
     @classmethod
-    def __initialize__(cls):
+    def __initialize__(cls, schema):
         """initialize a specific entity class by adding descriptors to access
         entity type's attributes and relations
         """
         etype = cls.id
         assert etype != 'Any', etype
-        cls.e_schema = eschema = cls.schema.eschema(etype)
+        cls.e_schema = eschema = schema.eschema(etype)
         for rschema, _ in eschema.attribute_definitions():
             if rschema.type == 'eid':
                 continue