def run(self, runtime): path = self['path'] for registration in Format.read(self['config']): implementation = import_object(registration['implementation']) constructor = StaticConstructor(implementation.config, registration['archetypes']) runtime.execute('mesh.javascript', path=path, bundle=constructor.construct())
def _construct_mount(self, archetype, model): resource = Resource controller = None for version, mixins, mixin_controller in archetype.config.resources: if resource.version != version[0]: resource = self._construct_resource(archetype, resource, version[0], mixins) controller = self._construct_controller( model, resource, version, controller, import_object(mixin_controller) ) return mount(resource, controller)
def _construct_mount(self, archetype, model): resource = Resource controller = None for version, mixins, mixin_controller in archetype.config.resources: if resource.version != version[0]: resource = self._construct_resource(archetype, resource, version[0], mixins) controller = self._construct_controller( model, resource, version, controller, import_object(mixin_controller)) return mount(resource, controller)
def _bootstrap_prototype(self, session, prototype): bundle = import_object(prototype.config.bundle) for archetype in session.query(prototype): model = self.models[archetype.id] = self._construct_model(archetype) bundle.attach([self._construct_mount(archetype, model)])
def construct(self): bundle = import_object(self.config.bundle) for archetype in self.archetypes: bundle.attach([self._construct_mount(archetype)]) return bundle
def _bootstrap_prototype(self, session, prototype): bundle = import_object(prototype.config.bundle) for archetype in session.query(prototype): model = self.models[archetype.id] = self._construct_model( archetype) bundle.attach([self._construct_mount(archetype, model)])
def instantiate(self, unit): if isinstance(unit, basestring): unit = import_object(unit) return self.acquire(unit.identity, unit, ())