these are regular expressions, p and q are just variables.
On Sep 1, 5:43 am, max <[email protected]> wrote:
> I am interested in knowing how can i do this for %
> routes_in=(('(?P<p>.*?),(?P<q>.*)':'\g<p>?other=\g<q>'),)
>
> What does p ,q and other define in the routes_in file?
>
> On 1 Sep., 03:49, mdipierro <[email protected]> wrote:
>
> > In my mind I think of a URL as a filename,so I think of request.args
> > as objects that can be used to build actual filenames. Allowing non [a-
> > zA-Z0-9_] characters in args may create potential directory traversal
> > attacks when args is used in this way.
>
> > On Aug 31,8:33 pm,"mr.freeze" <[email protected]> wrote:
>
> > > 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 <[email protected]> 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" <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---