コード例 #1
0
ファイル: followup_api.py プロジェクト: usersource/anno
    def followup_list(self, request):
        """
        Exposes an API endpoint to retrieve a list of follow up.
        """
        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)

        query = FollowUp.query().order(-FollowUp.created)
        if curs is not None:
            followups, next_curs, more = query.fetch_page(limit, start_cursor=curs)
        else:
            followups, next_curs, more = query.fetch_page(limit)

        items = [entity.to_message() for entity in followups]
        if more:
            return FollowupListMessage(followup_list=items, cursor=next_curs.urlsafe(), has_more=more)
        else:
            return FollowupListMessage(followup_list=items, has_more=more)
コード例 #2
0
def update_followup_indices(cursor=None):
    followup_list, cursor, more = FollowUp.query().fetch_page(BATCH_SIZE, start_cursor=cursor)

    for followup in followup_list:
#         regenerate_index(followup, SearchIndexName.FOLLOWUP)
        create_tags(followup.comment)

    if more:
        update_followup_indices(cursor=cursor)