예제 #1
0
파일: relations.py 프로젝트: 4bic/grano
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)
예제 #2
0
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)
예제 #3
0
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)
예제 #4
0
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)
예제 #5
0
파일: entities.py 프로젝트: scott2b/grano
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)
예제 #6
0
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)
예제 #7
0
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)
예제 #8
0
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)
예제 #9
0
파일: manage.py 프로젝트: jacqui/grano
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)
예제 #10
0
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)
예제 #11
0
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)
예제 #12
0
파일: schemata.py 프로젝트: 01-/grano
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)
예제 #13
0
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)
예제 #14
0
파일: background.py 프로젝트: 01-/grano
def periodic():
    def _handle(obj):
        obj.run()
    notify_plugins('grano.periodic', _handle)
예제 #15
0
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)
예제 #16
0
def periodic():
    def _handle(obj):
        obj.run()

    notify_plugins('grano.periodic', _handle)