How to make a redirect and keep the query string?

Niklas R. picture Niklas R. · May 13, 2012 · Viewed 10.3k times · Source

I want to make a redirect and keep what is the query string. Something like self.redirect plus the query parameters that was sent. Is that possible?

Answer

Steven Almeroth picture Steven Almeroth · May 14, 2012
newurl = '/my/new/route?' + urllib.urlencode(self.request.params)
self.redirect(newurl)