You no longer have to @expose() generic controller handlers. You can
simply pass through any keyword arguments you like, just as you would to @expose(). See tests for examples.
This commit is contained in:
@@ -6,8 +6,9 @@ def _cfg(f):
|
||||
|
||||
|
||||
def when_for(controller):
|
||||
def when(method):
|
||||
def when(method=None, **kw):
|
||||
def decorate(f):
|
||||
expose(**kw)(f)
|
||||
_cfg(f)['generic_handler'] = True
|
||||
controller.pecan['generic_handlers'][method.upper()] = f
|
||||
return f
|
||||
|
||||
@@ -11,13 +11,11 @@ class TestGeneric(object):
|
||||
def index(self):
|
||||
pass
|
||||
|
||||
@index.when(method='POST')
|
||||
@expose('json')
|
||||
@index.when(method='POST', template='json')
|
||||
def do_post(self):
|
||||
return dict(result='POST')
|
||||
|
||||
@index.when(method='GET')
|
||||
@expose()
|
||||
def do_get(self):
|
||||
return 'GET'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user