Пример #1
0
def setup_app(commands, conf, vars):
    # load_configuration and init_model are required for every entry point that
    # likes database or file access
    load_configuration(config, conf.global_conf, conf.local_conf)
    init_model(engine_from_config(config, 'sqlalchemy.'))

    Base.metadata.create_all(bind=Session.bind)
Пример #2
0
def make_app(global_conf, **app_conf):
    from paste.lint import middleware

    load_configuration(config, global_conf, app_conf)

    init_model(engine_from_config(config, "sqlalchemy."))

    app = SimpleMessageQueue(global_conf=global_conf)
    app = middleware(app)
    return app
Пример #3
0
    def command(self):
        conf = 'config:{0}'.format(self.args[0])
        here = os.getcwd()

        conf = appconfig(conf, relative_to=here)
        conf.global_conf['running_as_script'] = True
        load_configuration(config, conf.global_conf, conf.local_conf)
        init_model(engine_from_config(config, 'sqlalchemy.'))

        count = 0
        for item in model.list_due_items():
            item.claimed = None
            count += 1
        model.commit()
        if count > 0:
            print >> sys.stderr, 'Released {0} message(s).'.format(count)