findChangeLog: don't crash if sort is unspecified

This would crash:

    api.findChangeLogs(keys=[])

because there's no 'name' key for changelog entries. Instead, default to
chronological order, newest first.
This commit is contained in:
Will Thompson 2015-05-06 19:00:44 +02:00 committed by j
parent ff3864b347
commit f9ba4d1bf1

View file

@ -18,7 +18,7 @@ import models
def parse_query(data, user): def parse_query(data, user):
query = {} query = {}
query['range'] = [0, 100] query['range'] = [0, 100]
query['sort'] = [{'key':'name', 'operator':'+'}] query['sort'] = [{'key':'created', 'operator':'-'}]
for key in ('keys', 'group', 'list', 'range', 'sort', 'query'): for key in ('keys', 'group', 'list', 'range', 'sort', 'query'):
if key in data: if key in data:
query[key] = data[key] query[key] = data[key]