本文整理汇总了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')
示例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))
示例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)
示例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)