예제 #1
0
def includeme(config):
    engine = create_datastore(os.getenv(config.registry.settings['mongo_url_env'], 'openrosetta'))
    session.bind = engine
    Mapper.compile_all()

    for mapper in Mapper.all_mappers():
        session.ensure_indexes(mapper.collection)

    config.add_tween('openrosetta.models.ming_autoflush_tween', over=EXCVIEW)
예제 #2
0
    def __call__(self, app, core, config):
        mainsession.bind = self.mongo_engine

        Mapper.compile_all()

        for mapper in Mapper.all_mappers():
            mainsession.ensure_indexes(mapper.collection)

        app = MingMiddleware(app)

        return app
예제 #3
0
 def things_related_to_project(self, pid):
     result = []
     ac_ids = [ac._id for ac in M.AppConfig.query.find(dict(project_id=pid))]
     for m in Mapper.all_mappers():
         cls = m.mapped_class
         things = None
         if 'project_id' in m.property_index:
             things = cls.query.find(dict(project_id=pid)).all()
         elif 'app_config_id' in m.property_index:
             things = cls.query.find(dict(app_config_id={'$in': ac_ids})).all()
         if things:
             result.extend(things)
     return result
예제 #4
0
 def things_related_to_project(self, pid):
     result = []
     ac_ids = [ac._id for ac in M.AppConfig.query.find(dict(project_id=pid))]
     for m in Mapper.all_mappers():
         cls = m.mapped_class
         things = None
         if 'project_id' in m.property_index:
             things = cls.query.find(dict(project_id=pid)).all()
         elif 'app_config_id' in m.property_index:
             things = cls.query.find(dict(app_config_id={'$in': ac_ids})).all()
         if things:
             result.extend(things)
     return result
예제 #5
0
파일: __init__.py 프로젝트: bdeeney/crudite
def init_db(session):
    Mapper.compile_all()
    for mapper in Mapper.all_mappers():
        session.ensure_indexes(mapper.collection)
예제 #6
0
파일: __init__.py 프로젝트: bdeeney/crudite
def init_db(session):
    Mapper.compile_all()
    for mapper in Mapper.all_mappers():
        session.ensure_indexes(mapper.collection)