Skip to content

Instantly share code, notes, and snippets.

@iraycd
Created February 5, 2015 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iraycd/4549c5e871c739c8f4c3 to your computer and use it in GitHub Desktop.
Save iraycd/4549c5e871c739c8f4c3 to your computer and use it in GitHub Desktop.
Wheezy Admin Handler
from wheezy.web.authorization import authorize
from wheezy.web.handlers import BaseHandler
class AdminHandler(BaseHandler):
@authorize(roles=('admin',))
def __call__(self):
method = self.request.method
if method == 'GET':
return self.get()
elif method == 'POST':
return self.post()
elif method == 'PUT':
return self.put()
elif method == 'DELETE':
return self.delete()
return method_not_allowed()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment