diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2014-04-07 12:23:14 +0200 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2014-04-07 12:23:14 +0200 |
commit | 7e70cc28db02cbbc1509776b9515f96fe6091d3b (patch) | |
tree | 3431c9f334220e910c09a8468b7d73beeb86ac4b /app/handlers/defconf.py | |
parent | 20700de0d08785f3da161e7a3a7126b3b609f428 (diff) |
Implement _delete method.
Diffstat (limited to 'app/handlers/defconf.py')
-rw-r--r-- | app/handlers/defconf.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/app/handlers/defconf.py b/app/handlers/defconf.py index 7bafec0..b59871b 100644 --- a/app/handlers/defconf.py +++ b/app/handlers/defconf.py @@ -15,7 +15,6 @@ """The RequestHandler for /defconfig URLs.""" -import json import tornado from functools import partial @@ -42,17 +41,12 @@ class DefConfHandler(BaseHandler): return valid_keys.get(method, None) - def delete(self, *args, **kwargs): - self._check_content_type() - - json_obj = json.loads(self.request.body.decode('utf8')) - if self._has_valid_keys(json_obj, self._valid_keys('DELETE')): - self.executor.submit( - partial(delete, json_obj['defconf']) - ).add_done_callback( - lambda future: tornado.ioloop.IOLoop.instance().add_callback( - partial(self._create_valid_response, future.result()) - ) + def _delete(self, json_obj): + self.executor.submit( + partial(delete, json_obj['defconf']) + ).add_done_callback( + lambda future: + tornado.ioloop.IOLoop.instance().add_callback( + partial(self._create_valid_response, future.result()) ) - else: - self.send_error(status_code=400) + ) |