routes_in = (
('/(?P<all>.+)', '/myapp/default/padrao?\g<all>'),
)
In this case I can get 'full' URL (I say 'full' because I don't get
"http://127.0.0.1:800") with request.env.query_string. But in cases
that I have:
routes_in = (
('/(A|B)(?P<all>.+)', '/myapp/default/padrao?\g<all>'),
)
I can't get "A" or "B", only the expression matched by "(?P<all>.+)".
Is there an way to get "full" URL that I like - am I missing something?
If there isn't, can it be implemented to future versions?
Thanks.
--
Álvaro Justen
Peta5 - Telecomunicações e Software Livre
21 3021-6001 / 9898-0141
http://www.peta5.com.br/
Thanks. :-)
Another improvement: if routes_out is not defined, I think web2py can
create it directly based on routes_in, like:
routes_out = map(lambda x:(x[1], x[0]), routes_in)
If you do not want this to be default, just add as a comment in
routes.py - it can save time of many developers to don't
copy-paste-and-invert-tuples.
In fact, it won't work if you use regexes to rewrite URLs, but works
for all static cases.
Yes, I have this code in apps that doesn't use regex. But my last
email I suggest to add it in routes.py like a *comment*, emphazising
that it can be used only in non-regex casees (and then developer only
have to uncomment the line, like other web2py code (auth, crud etc.)
to use that functionality).
Will this be added?
I was talking about get full URL in request...
Even if I have a rewrite, I want to know what URL user requested:
> >> I want a manner to get full GET URL from client, but using a rewrite
> >> in routes_in I can get only a half of. An example:
> >> routes_in = (
> >> ('/(?P<all>.+)', '/myapp/default/padrao?\g<all>'),
> >> )
> >> In this case I can get 'full' URL (I say 'full' because I don't get
> >> "http://127.0.0.1:800") with request.env.query_string. But in cases
> >> that I have:
> >> routes_in = (
> >> ('/(A|B)(?P<all>.+)', '/myapp/default/padrao?\g<all>'),
> >> )
> >> I can't get "A" or "B", only the expression matched by "(?P<all>.+)".
> >> Is there an way to get "full" URL that I like - am I missing something?
> >> If there isn't, can it be implemented to future versions?
--