def _relation_changed(relation_id, operation): """ Notify plugins about changes to a relation. """ def _handle(obj): obj.relation_changed(relation_id, operation) notify_plugins("grano.relation.change", _handle)
def _entity_changed(entity_id): """ Notify plugins about changes to an entity. """ log.warn("Processing change in entity: %s", entity_id) def _handle(obj): obj.entity_changed(entity_id) notify_plugins('grano.entity.change', _handle)
def _relation_changed(relation_id): """ Notify plugins about changes to a relation. """ log.debug("Processing change in relation: %s", relation_id) def _handle(obj): obj.relation_changed(relation_id) notify_plugins("grano.relation.change", _handle)
def _relation_changed(relation_id): """ Notify plugins about changes to a relation. """ log.warn("Processing change in relation: %s", relation_id) def _handle(obj): obj.relation_changed(relation_id) notify_plugins('grano.relation.change', _handle)
def _entity_changed(entity_id, operation): """ Notify plugins about changes to an entity. """ def _handle(obj): obj.entity_changed(entity_id, operation) notify_plugins('grano.entity.change', _handle)
from flask.ext.migrate import MigrateCommand from grano.core import db, migrate from grano.views import app from grano.model import Project from grano.logic import import_schema, export_schema from grano.logic import import_aliases, export_aliases from grano.logic import rebuild as rebuild_ from grano.logic.accounts import console_account from grano.logic.projects import save as save_project from grano.plugins import list_plugins, notify_plugins log = logging.getLogger('grano') manager = Manager(app) manager.add_command('db', MigrateCommand) notify_plugins('grano.startup', lambda o: o.configure(manager)) @manager.command def schema_import(project, path): """ Load a schema specification from a YAML file. """ pobj = Project.by_slug(project) if pobj is None: pobj = save_project({ 'slug': project, 'label': project, 'author': console_account() }) with open(path, 'r') as fh: import_schema(pobj, fh)
def _project_changed(project_slug, operation): """ Notify plugins about changes to a relation. """ def _handle(obj): obj.project_changed(project_slug, operation) notify_plugins('grano.project.change', _handle)
from flask.ext.migrate import MigrateCommand from grano.views import app from grano.model import Project from grano.logic import import_schema, export_schema from grano.logic import import_aliases, export_aliases from grano.logic import rebuild as rebuild_ from grano.logic.accounts import console_account from grano.logic.projects import save as save_project from grano.plugins import list_plugins, notify_plugins log = logging.getLogger('grano') manager = Manager(app) manager.add_command('db', MigrateCommand) notify_plugins('grano.startup', lambda o: o.configure(manager)) @manager.command def schema_import(project, path): """ Load a schema specification from a YAML file. """ pobj = Project.by_slug(project) if pobj is None: pobj = save_project({ 'slug': project, 'label': project, 'author': console_account() }) with open(path, 'r') as fh: import_schema(pobj, fh)
def _entity_changed(entity_id): """ Notify plugins about changes to an entity. """ log.debug("Processing change in entity: %s", entity_id) def _handle(obj): obj.entity_changed(entity_id) notify_plugins('grano.entity.change', _handle)
def _schema_changed(project_slug, schema_name, operation): """ Notify plugins about changes to a schema. """ def _handle(obj): obj.schema_changed(project_slug, schema_name, operation) notify_plugins('grano.schema.change', _handle)
def periodic(): def _handle(obj): obj.run() notify_plugins('grano.periodic', _handle)
def _relation_changed(relation_id, operation): """ Notify plugins about changes to a relation. """ def _handle(obj): obj.relation_changed(relation_id, operation) notify_plugins('grano.relation.change', _handle)