diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2014-07-29 11:06:44 +0200 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2014-07-29 11:06:44 +0200 |
commit | dab66458f7a1b6fc6448d53f420d066e676dfee4 (patch) | |
tree | acb744423a6486a94e96d5387d252f1a1dce8c74 /app/handlers/base.py | |
parent | 532ed351878f142f6e2a7fb414540e3e57f953a4 (diff) |
decorators: Rework decorators implementation.
* Add decorator for TokenHandler methods.
* Decorators now accept a parameter to validate the HTTP method
used.
* Fix base and count handlers.
Change-Id: I1479186494d1bdb2dc2ba3bb240e8f6a5cd5665c
Diffstat (limited to 'app/handlers/base.py')
-rw-r--r-- | app/handlers/base.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/handlers/base.py b/app/handlers/base.py index 56049e6..4553200 100644 --- a/app/handlers/base.py +++ b/app/handlers/base.py @@ -185,7 +185,7 @@ class BaseHandler(RequestHandler): return valid_content - @protected + @protected("POST") @asynchronous def post(self, *args, **kwargs): @@ -229,7 +229,7 @@ class BaseHandler(RequestHandler): """ self.write_error(status_code=501) - @protected + @protected("DELETE") @asynchronous def delete(self, *args, **kwargs): if kwargs and kwargs.get('id', None): @@ -249,7 +249,7 @@ class BaseHandler(RequestHandler): """ self.write_error(status_code=501) - @protected + @protected("GET") @asynchronous def get(self, *args, **kwargs): if kwargs and kwargs.get('id', None): |