Added a decorator to easily specify allowed HTTP verbs for controller callables
parent
4c4ecbfe52
commit
a07f6963aa
|
@ -20,3 +20,18 @@ from webob.exc import *
|
||||||
from webob.request import *
|
from webob.request import *
|
||||||
from webob.response import *
|
from webob.response import *
|
||||||
from auth.decorators import *
|
from auth.decorators import *
|
||||||
|
|
||||||
|
def allow(*methods):
|
||||||
|
'''Specify the allowed HTTP verbs for a controller callable
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
@milla.allow('GET', 'POST')
|
||||||
|
def controller(request):
|
||||||
|
return 'Hello, world!'
|
||||||
|
'''
|
||||||
|
|
||||||
|
def wrapper(func):
|
||||||
|
func.allowed_methods = methods
|
||||||
|
return func
|
||||||
|
return wrapper
|
||||||
|
|
Loading…
Reference in New Issue