Query string lost when redirecting through routes.py

25 views
Skip to first unread message

Louis Amon

unread,
Feb 25, 2015, 6:00:09 AM2/25/15
to web...@googlegroups.com
Hello,

I'm trying to map this URL : localhost:8000/annonces?lat=48.8610181&lng=2.3140934&locality=Paris
To this : localhost:8000/s/paris

(Full-text search hurrayyy)


I'm using the pattern-based routes.py to do that :

routes_in =[...

            ('/annonces', '301->/s'),
]


But when I try to reach the URL above, I get redirected to "localhost:8000/s" with no query string (no request.vars).

This is the rewrite log I get:

routes_app: [127.0.0.1:http://localhost:get /annonces] [jestocke] -> jestocke

select routing parameters: jestocke

routes_in: [127.0.0.1:http://localhost:get /annonces] [301->/s\g<anything>] -> 301->/s

routes_app: [127.0.0.1:http://localhost:get /s] [jestocke] -> jestocke

select routing parameters: jestocke

routes_in: [127.0.0.1:http://localhost:get /s] [/jestocke/offer/search] -> /jestocke/offer/search



Am I missing something there ?

Anthony

unread,
Feb 25, 2015, 7:07:20 AM2/25/15
to web...@googlegroups.com
You need to match and copy the query string explicitly:

('/annonces$query', '301->/s$query')

Louis Amon

unread,
Feb 25, 2015, 8:03:43 AM2/25/15
to web...@googlegroups.com
That’s odd.

I put exactly the rule you proposed but the URL (http://localhost:8000/annonces?lat=48.8610181&lng=2.3140934&locality=Paris) ended up not being matched at all.

Log statement:
routes_in: [127.0.0.1:http://localhost:get /annonces] -> /annonces (not rewritten)

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/g1oVFepFQ5o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages