shazaman23 / webapp-improved

Automatically exported from code.google.com/p/webapp-improved
Other
0 stars 0 forks source link

uri_for and positional arguments is weird #89

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If you set up a route with positional arguments:

   Route(r'/foo/<>', Foo, name='foo'),

then route building with uri_for requires you to pass an extra "None":

   uri_for('foo', None, 'bar')

whereas the straightforward syntax doesn't work:

   uri_for('foo', 'bar')
   Traceback (most recent call last):
   ...
   AttributeError: 'str' object has no attribute 'app'

This is because of the argspec def uri_for(_name, _request=None, *args, 
**kwargs), the _request should probably be a keyword argument and not an 
optional positional argument.

Original issue reported on code.google.com by vbraun.n...@gmail.com on 22 Apr 2014 at 12:17