Ejemplo n.º 1
0
def get_next_page_of_all_non_private_commits(
        page_size=feconf.COMMIT_LIST_PAGE_SIZE,
        urlsafe_start_cursor=None,
        max_age=None):
    """Returns a page of non-private commits in reverse time order. If max_age
    is given, it should be a datetime.timedelta instance.

    The return value is a triple (results, cursor, more) as described in
    fetch_page() at:

        https://developers.google.com/appengine/docs/python/ndb/queryclass
    """
    if max_age is not None and not isinstance(max_age, datetime.timedelta):
        raise ValueError(
            "max_age must be a datetime.timedelta instance. or None.")

    results, new_urlsafe_start_cursor, more = (
        collection_models.CollectionCommitLogEntryModel.
        get_all_non_private_commits(  # pylint: disable=line-too-long
            page_size,
            urlsafe_start_cursor,
            max_age=max_age))

    return ([
        collection_domain.CollectionCommitLogEntry(
            entry.created_on, entry.last_updated, entry.user_id,
            entry.username, entry.collection_id, entry.commit_type,
            entry.commit_message, entry.commit_cmds, entry.version,
            entry.post_commit_status, entry.post_commit_community_owned,
            entry.post_commit_is_private) for entry in results
    ], new_urlsafe_start_cursor, more)
Ejemplo n.º 2
0
def get_next_page_of_all_commits(
        page_size=feconf.COMMIT_LIST_PAGE_SIZE, urlsafe_start_cursor=None):
    """Returns a page of commits to all collections in reverse time order.

    The return value is a triple (results, cursor, more) as described in
    fetch_page() at:

        https://developers.google.com/appengine/docs/python/ndb/queryclass
    """
    results, new_urlsafe_start_cursor, more = (
        collection_models.CollectionCommitLogEntryModel.get_all_commits(
            page_size, urlsafe_start_cursor))

    return ([collection_domain.CollectionCommitLogEntry(
        entry.created_on, entry.last_updated, entry.user_id, entry.username,
        entry.collection_id, entry.commit_type, entry.commit_message,
        entry.commit_cmds, entry.version, entry.post_commit_status,
        entry.post_commit_community_owned, entry.post_commit_is_private
    ) for entry in results], new_urlsafe_start_cursor, more)