Merge pull request #2362 from coreos-inc/fix-none-queries
Fix handling of None queries
This commit is contained in:
commit
c4837d87b3
1 changed files with 8 additions and 3 deletions
|
@ -287,7 +287,7 @@ def put_repository_auth(namespace_name, repo_name):
|
||||||
@process_auth
|
@process_auth
|
||||||
@anon_protect
|
@anon_protect
|
||||||
def get_search():
|
def get_search():
|
||||||
query = request.args.get('q')
|
query = request.args.get('q') or ''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
limit = min(100, max(1, int(request.args.get('n', 25))))
|
limit = min(100, max(1, int(request.args.get('n', 25))))
|
||||||
|
@ -327,8 +327,13 @@ def _conduct_repo_search(username, query, limit=25, page=1):
|
||||||
page = min(page, _MAX_PAGE_COUNT)
|
page = min(page, _MAX_PAGE_COUNT)
|
||||||
|
|
||||||
only_public = username is None
|
only_public = username is None
|
||||||
matching_repos = model.get_sorted_matching_repositories(query, only_public, can_read,
|
|
||||||
limit=limit*_MAX_PAGE_COUNT)
|
if query:
|
||||||
|
matching_repos = model.get_sorted_matching_repositories(query, only_public, can_read,
|
||||||
|
limit=limit*_MAX_PAGE_COUNT)
|
||||||
|
else:
|
||||||
|
matching_repos = []
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
for repo in matching_repos[(page - 1) * _MAX_PAGE_COUNT:limit]:
|
for repo in matching_repos[(page - 1) * _MAX_PAGE_COUNT:limit]:
|
||||||
results.append({
|
results.append({
|
||||||
|
|
Reference in a new issue