diff --git a/src/milla/__init__.py b/src/milla/__init__.py index 49396ba..c391afb 100644 --- a/src/milla/__init__.py +++ b/src/milla/__init__.py @@ -20,3 +20,18 @@ from webob.exc import * from webob.request import * from webob.response 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