本文整理匯總了Python中model.anno.Anno.query_by_app方法的典型用法代碼示例。如果您正苦於以下問題:Python Anno.query_by_app方法的具體用法?Python Anno.query_by_app怎麽用?Python Anno.query_by_app使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model.anno.Anno
的用法示例。
在下文中一共展示了Anno.query_by_app方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: anno_list
# 需要導入模塊: from model.anno import Anno [as 別名]
# 或者: from model.anno.Anno import query_by_app [as 別名]
def anno_list(self, request):
"""
Exposes an API endpoint to retrieve a list of anno.
"""
user = auth_user(self.request_state.headers)
limit = 10
if request.limit is not None:
limit = request.limit
is_plugin = request.is_plugin or False
curs = None
if request.cursor is not None:
try:
curs = Cursor(urlsafe=request.cursor)
except BadValueError:
raise endpoints.BadRequestException('Invalid cursor %s.' % request.cursor)
select_projection = None
if request.select is not None:
select_projection = request.select.split(',')
if request.query_type == AnnoQueryType.CREATED:
return Anno.query_by_app_by_created(request.app, limit, select_projection, curs, user)
elif request.query_type == AnnoQueryType.VOTE_COUNT:
return Anno.query_by_vote_count(request.app, user)
elif request.query_type == AnnoQueryType.FLAG_COUNT:
return Anno.query_by_flag_count(request.app, user)
elif request.query_type == AnnoQueryType.ACTIVITY_COUNT:
return Anno.query_by_activity_count(request.app, user)
elif request.query_type == AnnoQueryType.LAST_ACTIVITY:
return Anno.query_by_last_activity(request.app, user)
elif request.query_type == AnnoQueryType.COUNTRY:
return Anno.query_by_country(request.app, user)
elif request.query_type == AnnoQueryType.COMMUNITY:
community = Community.get_by_id(request.community)
return Anno.query_by_community(community, limit, select_projection, curs, user)
elif request.query_type == AnnoQueryType.APP:
app = AppInfo.get(request.app)
return Anno.query_by_app(app, limit, select_projection, curs, user)
else:
return Anno.query_by_page(limit, select_projection, curs, user, is_plugin)