Fix the Repository ID in pagination problem once and for all

But.... ONCE AND FOR ALL!

Note: Tested on SQLite, Postgres and MySQL
This commit is contained in:
Joseph Schorr 2016-07-14 17:09:52 -04:00
parent 1ed1bc9ed3
commit 4e1259b58a
2 changed files with 16 additions and 10 deletions

View file

@ -9,10 +9,11 @@ from datetime import timedelta, datetime
from flask import request, abort
from data import model
from data.database import Repository as RepositoryTable
from endpoints.api import (truthy_bool, format_date, nickname, log_action, validate_json_request,
require_repo_read, require_repo_write, require_repo_admin,
RepositoryParamResource, resource, query_param, parse_args, ApiResource,
request_error, require_scope, path_param, page_support, parse_args,
request_error, require_scope, path_param, page_support, parse_args,
query_param, truthy_bool)
from endpoints.exception import Unauthorized, NotFound, InvalidRequest, ExceedsLicenseException
from endpoints.api.billing import lookup_allowed_private_repos, get_namespace_plan
@ -165,9 +166,9 @@ class RepositoryList(ApiResource):
# Note: We only limit repositories when there isn't a namespace or starred filter, as they
# result in far smaller queries.
if not parsed_args['namespace'] and not parsed_args['starred']:
repos, next_page_token = model.modelutil.paginate(repo_query, repo_query.c,
repos, next_page_token = model.modelutil.paginate(repo_query, RepositoryTable,
page_token=page_token, limit=REPOS_PER_PAGE,
id_field='rid')
id_alias='rid')
else:
repos = list(repo_query)
next_page_token = None