pombreda / webapp-improved

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

Please add a kwarg to the Route object which makes trailing slash optional #99

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
See attached file.

It'd be great to be able to pass a kwarg to the Route object which makes 
trailing slashes optional.  I know you can do this with a redirect, but that is 
an extra request and not strictly required.  It'd be great if you could add 
something like in my example so it fulfils the request but makes the slash 
optional.

Thanks,

Rob

Original issue reported on code.google.com by r...@appinstitute.co.uk on 22 Jan 2015 at 5:56

Attachments:

GoogleCodeExporter commented 9 years ago
You can use 
RedirectRoute(https://webapp-improved.appspot.com/_modules/webapp2_extras/routes
.html#RedirectRoute)

using attribute strict_slash will enforce always a trailing slash in each route.

Original comment by jandro.c...@gmail.com on 26 Feb 2015 at 11:04

GoogleCodeExporter commented 9 years ago
RedirectRoute requires a redirect which is costly.  There is no need for a 
browser redirect in this case as webapp2 could just return the content.

Original comment by r...@appinstitute.co.uk on 26 Feb 2015 at 11:13

GoogleCodeExporter commented 9 years ago
I can see how the recirect could be useful in certain circumstances through so 
I don't advise changing the current functionality.  I actually added this 
functionality myself by subclassing Route.

Original comment by r...@appinstitute.co.uk on 26 Feb 2015 at 11:14

GoogleCodeExporter commented 9 years ago
That's True.. How do you actually subclass Route? I mean how do you add this 
functionality?

Original comment by jandro.c...@gmail.com on 26 Feb 2015 at 4:43