j2labs/brubeck — Issue #54: app.add_route decorator is not working with parameters
Author: tonytan4ever
Created: 2012-02-28 23:38:18+00:00
State: open

I tryied the decorator/function approach to write the views, but it seems not working.

@app.add_route('^/deco/(?P\w+)$', method='GET')
def new_name_handler(application, message, name):
print message
return http_response('Take five, %s!' % (name), 200, 'OK', {})

app.run

gives me this error:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/usr/local/lib/python2.6/dist-packages/brubeck/request_handling.py", line 118, in request_handler
response = handler()
File "/usr/local/lib/python2.6/dist-packages/brubeck/request_handling.py", line 774, in
handler = lambda: kallable(self, message, **kwargs)
TypeError: check_method() got an unexpected keyword argument 'name'
, at 0x97f87d4>)> failed with TypeError

Please show me the correct way of doing it.