diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2014-10-15 21:01:34 +0200 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2014-10-15 21:01:34 +0200 |
commit | 4ed4b29d06428f4d831b214868b0887a2b5b43fb (patch) | |
tree | 690782199691aae69d9a459f7cd0a15196b24d5b /app/handlers/boot.py | |
parent | 65564cf3f8108a9f71f81b8f203c2c127e75a91d (diff) |
handlers: Use the newly defined keys and values.
* Refactor handlers code to use the newly defined keys.
Change-Id: Ib14578bd1f2a57297b2296a0c1d12824700c9f2e
Diffstat (limited to 'app/handlers/boot.py')
-rw-r--r-- | app/handlers/boot.py | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/app/handlers/boot.py b/app/handlers/boot.py index 199af93..fb99700 100644 --- a/app/handlers/boot.py +++ b/app/handlers/boot.py @@ -16,20 +16,12 @@ """The RequestHandler for /boot URLs.""" from handlers.base import BaseHandler -from handlers.common import get_query_spec -from handlers.response import HandlerResponse -from models import ( - BOARD_KEY, - CREATED_KEY, - DEFCONFIG_KEY, - JOB_ID_KEY, - JOB_KEY, - KERNEL_KEY, - STATUS_KEY, - TIME_KEY, - WARNINGS_KEY, +from handlers.common import ( + BOOT_VALID_KEYS, + get_query_spec, ) -from models.boot import BOOT_COLLECTION +from handlers.response import HandlerResponse +from models import BOOT_COLLECTION from taskqueue.tasks import import_boot from utils.db import ( delete, @@ -48,18 +40,7 @@ class BootHandler(BaseHandler): return self.db[BOOT_COLLECTION] def _valid_keys(self, method): - valid_keys = { - 'POST': [JOB_KEY, KERNEL_KEY], - 'GET': [ - CREATED_KEY, WARNINGS_KEY, JOB_ID_KEY, BOARD_KEY, - JOB_KEY, KERNEL_KEY, DEFCONFIG_KEY, TIME_KEY, STATUS_KEY, - ], - 'DELETE': [ - JOB_KEY, KERNEL_KEY, DEFCONFIG_KEY, BOARD_KEY, JOB_ID_KEY - ] - } - - return valid_keys.get(method, None) + return BOOT_VALID_KEYS.get(method, None) def _post(self, *args, **kwargs): response = HandlerResponse(202) |