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


Python Anno.query_by_page方法代码示例

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


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

示例1: anno_list

# 需要导入模块: from model.anno import Anno [as 别名]
# 或者: from model.anno.Anno import query_by_page [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

        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 == 'by_created':
            return Anno.query_by_app_by_created(request.app, limit, select_projection, curs)
        elif request.query_type == 'by_vote_count':
            return Anno.query_by_vote_count(request.app)
        elif request.query_type == 'by_flag_count':
            return Anno.query_by_flag_count(request.app)
        elif request.query_type == 'by_activity_count':
            return Anno.query_by_activity_count(request.app)
        elif request.query_type == 'by_last_activity':
            return Anno.query_by_last_activity(request.app)
        elif request.query_type == 'by_country':
            return Anno.query_by_country(request.app)
        else:
            return Anno.query_by_page(limit, select_projection, curs)
开发者ID:topcircler,项目名称:anno,代码行数:36,代码来源:anno_api.py

示例2: anno_list

# 需要导入模块: from model.anno import Anno [as 别名]
# 或者: from model.anno.Anno import query_by_page [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)
开发者ID:usersource,项目名称:anno,代码行数:45,代码来源:anno_api.py


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