check that range is [int, int]

This commit is contained in:
j 2016-03-17 16:06:08 +01:00
parent e536dcb3b0
commit f0b8b2b81e
2 changed files with 3 additions and 0 deletions

1
.gitignore vendored
View file

@ -25,3 +25,4 @@ static/django_extensions
*.pyc *.pyc
*~ *~
*.swp *.swp
pandora/gunicorn_config.py

View file

@ -84,6 +84,8 @@ def parse_query(data, user):
for key in ('sort', 'keys', 'group', 'range', 'position', 'positions'): for key in ('sort', 'keys', 'group', 'range', 'position', 'positions'):
if key in data: if key in data:
query[key] = data[key] query[key] = data[key]
if [r for r in query['range'] if not isinstance(r, int)]:
query['range'] = [0, 0]
query['qs'] = models.Item.objects.find(data, user) query['qs'] = models.Item.objects.find(data, user)
if 'clips' in data: if 'clips' in data:
conditions = {'query': data['clips']['query']} conditions = {'query': data['clips']['query']}