Skip to content
Snippets Groups Projects
entities.py 505 B
Newer Older
from cubes.compound.entities import IContained, IContainer, structure_def


def agent_structure_def(schema):
    return structure_def(schema, 'Agent').items()


def registration_callback(vreg):
    # clear IContained._classes dict is necessary during tests where modules are not reloaded
    IContained._classes.clear()
    vreg.register(IContainer.build_class('Agent'))
    for etype, parent_relations in agent_structure_def(vreg.schema):
        IContained.register_class(vreg, etype, parent_relations)