Why are special characters allowed in request.vars but not request.args by default?
i.e. why does this work: http://127.0.0.1:8000/test/appadmin/state?london,_ontario But not this?: http://127.0.0.1:8000/test/appadmin/state/london,_ontario Just curious. On Aug 31, 7:58 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > Yes. in web2py URL are validated and special characters are not > allowed (by default). Spaces are replaced with _. > This can be changed by mappying parts of the URL, like the part after > the comma, into a variable. Example: > > http://127.0.0.1:8000/a/b/c,d > > you can create a file routes.py in web2py/ and in it > > routes_in=(('(?P<p>.*?),(?P<q>.*)':'\g<p>?other=\g<q>'),) > > then in app a, controller b.py and function c you can access > > request.vars.other > > which will contain 'd'. > > Massimo > > On Aug 31, 6:38 pm, "mr.freeze" <nat...@freezable.com> wrote: > > > It fails for me when passed as an argument even when it is URL > > encoded:http://127.0.0.1:8000/test/default/index/london%2C_ontario-Invalid > > request. > > > Passing as a query string works even when not > > encoded:http://127.0.0.1:8000/test/default/index?city=london,_ontario-Works > > fine. > > > Massimo, can you confirm that this is the expected behavior? > > > On Aug 31, 7:56 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > Your url does not pass validation and it is invalid. To allow this you > > > must create a routes_in for fit. > > > > On Aug 30, 9:20 pm, Derek <cunningh...@gmail.com> wrote: > > > > > Hi, > > > > > I'm doing some geocoding. I have a geocoder.py file with an index > > > > function. > > > > > A url like: > > > > > /geocoder/index/london > > > > > uses the value 'london' (stored in request.args[0]) just fine. But if > > > > I add acomma, as in: > > > > > /geocoder/index/london,_ontario > > > > > I get an "Invalid request" error. It's not even a web2py ticket. > > > > > Any thoughts? > > > > > Thanks, > > > > > Derek --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---