示例#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)