# HG changeset patch # User Sylvain Thénault # Date 1250153419 -7200 # Node ID 696ff03f9a5847bab24da04f73d2f75754c6a487 # Parent 9d7173656a1ab5b972d4a3379f4fab1e08b4ed18 __initialize__ needs the schema as argument diff -r 9d7173656a1a -r 696ff03f9a58 cwvreg.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 diff -r 9d7173656a1a -r 696ff03f9a58 entity.py --- 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