Hi,
I thought I would post a follow-up/update since I haven't seen any comments
on this. The essence is:
- I believe I have identified a bug in that, while you can use a
pattern-based incoming route in routes.py/routes_in to strip off part of
the incoming path and present it as a variable (I verified that it works by
debugging gluon/rewrite.py/regex_url_in()), the variable is not passed to
the controller.
- The reason seems to be that gluon/rewrite.py/regex_filter_in() updates
request.env with the lower-cased keys from environ (i.e. my var ends up in
request.env['query_string']), but gluon/globals.py/Request.parse_get_vars()
only looks for vars in request.env['QUERY_STRING']
- I dug this far with the idea that I might be able to contribute a patch,
but it is not obvious to me how to fix it, since (to start with) I do not
understand why we have both upper- and lower-case versions of these keys;
so, I am asking for some discussion.
- In the meantime, I worked around it by parsing request.env['query_string']
in the controller (which is working fine).
Thanks,
Rich Hogg
On Tuesday, April 28, 2015 at 3:26:23 PM UTC-4, Rich Hogg wrote:
>
> I've been trying to use a pattern-based incoming route to strip off some
> elements of the path and pass them to the controller as vars, e.g.
>
> routes_in = (
> ('/svn/(?P<svn_url>.*)', '/svnweb/default/index?svn_url=\g<svn_url>'),
> )
>
> It looks to me like regex_filter_in is doing what I would expect with
> this, but then in regex_url_in, the new query string is updated to
> request.env['query_string'] instead of request.env['QUERY_STRING']:
>
> request.env.update( (k*.lower()*.replace('.', '_'), v) for k, v in
> environ.iteritems())
> but request.env['QUERY_STRING'] is what is parsed later to get
> request.vars.
>
> I was hoping I would find some simple thing I could patch, but now it
> seems like it is tangled up in a design choice that has been in the repo
> for a while (in slightly different forms) and that I don't understand, so I
> am asking for help/advice. (Overall, BTW, I really like this platform.)
>
> -- Rich Hogg
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.