Commit 2ee07323 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

__initialize__ needs the schema as argument

parent 9d7173656a1a
......@@ -136,11 +136,11 @@ class ETypeRegistry(CWRegistry):
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
......
......@@ -170,13 +170,13 @@ class Entity(AppObject, dict):
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment