diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2014-04-23 12:01:43 +0200 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2014-04-23 12:01:43 +0200 |
commit | 91810f2e2c9b082b30e5539968134fe61b518898 (patch) | |
tree | 6773a41f3468f14166d4fedf633c750e4106b6b6 /app/handlers/base.py | |
parent | 8bd32a8e3766eee17f1ec9bce48d3be1f1b4a179 (diff) |
Fix and clean-up handlers.
Diffstat (limited to 'app/handlers/base.py')
-rw-r--r-- | app/handlers/base.py | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/app/handlers/base.py b/app/handlers/base.py index d7f6054..e3aac2a 100644 --- a/app/handlers/base.py +++ b/app/handlers/base.py @@ -30,9 +30,7 @@ from tornado.web import ( from models import DB_NAME from utils.db import ( - count_docs, find_and_count, - find_docs, find_one, ) from utils.log import get_log @@ -277,7 +275,8 @@ class BaseHandler(RequestHandler): :return The result from the database. """ return find_one( - self.collection, doc_id, fields=self._get_query_fields()) + self.collection, doc_id, fields=self._get_query_fields() + ) def _get(self, **kwargs): """Method called by the real GET one. @@ -298,23 +297,9 @@ class BaseHandler(RequestHandler): spec, sort, fields = self._get_query_args() - if spec: - return dict( - result=find_docs( - self.collection, - spec, - limit, - skip, - fields=fields, - sort=sort, - ), - count=count_docs(self.collection, spec), - limit=limit, - ) - else: - return find_and_count( - self.collection, limit, skip, fields=fields, sort=sort - ) + return find_and_count( + self.collection, limit, skip, spec=spec, fields=fields, sort=sort + ) def _get_query_args(self): """Retrieve all the arguments from the query string. |