当前位置: 首页>>代码示例>>Python>>正文


Python Project.all方法代码示例

本文整理汇总了Python中grano.model.Project.all方法的典型用法代码示例。如果您正苦于以下问题:Python Project.all方法的具体用法?Python Project.all怎么用?Python Project.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grano.model.Project的用法示例。


在下文中一共展示了Project.all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: rebuild

# 需要导入模块: from grano.model import Project [as 别名]
# 或者: from grano.model.Project import all [as 别名]
def rebuild():
    """ Execute the change processing handlers for all entities and
    relations currently loaded. This can be used as a housekeeping
    function. """

    for project in Project.all():
        _project_changed(project.slug, 'delete')
        _project_changed(project.slug, 'create')

        for schema in project.schemata:
            _schema_changed(schema.project.slug, schema.name, 'delete')
            _schema_changed(schema.project.slug, schema.name, 'create')

        eq = Entity.all().filter_by(same_as=None)
        eq = eq.filter_by(project=project)
        for i, entity in enumerate(eq):
            if i > 0 and i % 1000 == 0:
                log.info("Rebuilt: %s entities", i)
            _entity_changed(entity.id, 'delete')
            _entity_changed(entity.id, 'create')

        rq = Relation.all().filter_by(project=project)
        for i, relation in enumerate(rq):
            if i > 0 and i % 1000 == 0:
                log.info("Rebuilt: %s relation", i)
            _relation_changed(relation.id, 'delete')
            _relation_changed(relation.id, 'create')
开发者ID:01-,项目名称:grano,代码行数:29,代码来源:plugins.py

示例2: index

# 需要导入模块: from grano.model import Project [as 别名]
# 或者: from grano.model.Project import all [as 别名]
def index():
    q = Project.all()
    q = q.outerjoin(Permission)
    q = q.filter(or_(Project.private==False,
        and_(Permission.reader==True, Permission.account==request.account)))
    pager = Pager(q)
    conv = lambda es: [projects.to_rest_index_stats(e) for e in es]
    return jsonify(pager.to_dict(conv))
开发者ID:nimblemachine,项目名称:grano,代码行数:10,代码来源:projects_api.py

示例3: index

# 需要导入模块: from grano.model import Project [as 别名]
# 或者: from grano.model.Project import all [as 别名]
def index():
    q = Project.all()
    q = q.outerjoin(Permission)
    q = q.filter(or_(Project.private==False,
        and_(Permission.reader==True, Permission.account==request.account)))
    q = q.distinct()
    pager = Pager(q)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
开发者ID:ahurriyetoglu,项目名称:grano,代码行数:11,代码来源:projects_api.py

示例4: index

# 需要导入模块: from grano.model import Project [as 别名]
# 或者: from grano.model.Project import all [as 别名]
def index():
    q = Project.all()
    q = q.filter(Project.id.in_(authz.permissions().get('reader')))
    pager = Pager(q)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
开发者ID:01-,项目名称:grano,代码行数:8,代码来源:projects_api.py


注:本文中的grano.model.Project.all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。