diff --git a/oml/item/api.py b/oml/item/api.py index bc45b29..66ad801 100644 --- a/oml/item/api.py +++ b/oml/item/api.py @@ -9,13 +9,13 @@ from sqlalchemy.sql.expression import text from sqlalchemy import func from oxtornado import actions +import utils #utils must be imported before websocket to avoid loop from websocket import trigger_event import meta from . import models from . import query import settings import state -import utils from . import person_api from . import title_api diff --git a/oml/item/query.py b/oml/item/query.py index 195563e..a6a7049 100644 --- a/oml/item/query.py +++ b/oml/item/query.py @@ -10,6 +10,9 @@ from . import models import settings import utils +import logging +logger = logging.getLogger(__name__) + def parse(data): query = {} query['range'] = [0, 100] @@ -18,6 +21,9 @@ def parse(data): for key in ('keys', 'group', 'list', 'range', 'sort', 'query'): if key in data: query[key] = data[key] + if [r for r in query['range'] if not isinstance(r, int)]: + logger.error('range must be 2 integers! got this: %s', query['range']) + query['range'] = [0, 0] #print data query['qs'] = models.Item.find(data) if not 'group' in query: