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:
Jonathan LaCour
2010-11-18 12:36:26 -05:00
parent 98ef40daf8
commit 03d89b7bd5
2 changed files with 3 additions and 4 deletions

View File

@@ -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

View File

@@ -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'