Have a couple of pending patches. Will try process this within tonight
On Sep 21, 8:47 am, mwolfe02 <[email protected]> wrote: > I'm troubleshooting my routes_onerror by starting with a simple case, > redirecting everything to a status page for debugging: > > routes_onerror = [(r'*/*', r'/status/'),] > > When I type the following url into the browser: > > http://127.0.0.1:8000/faq > > I get redirected to this url: > > http://127.0.0.1:8000/status/?code=400&ticket=None&requested_uri=None > > I did some debugging and rewrite.py is using request.env.request_uri > to get the requested_uri. This is set to None in my particular > instance. However, request.url.text is set to /faq. So I made some > changes to rewrite.py which resulted in the following redirected url: > > http://127.0.0.1:8000/status/?code=400&ticket=None&requested_uri=None... > > I don't know what impact overwriting requested_uri would have on > backward compatibility or what the real difference is between > request.env.request_uri and request.url.text. But for me, in this > case, request.url.text is much more useful. What follows is the patch > to rewrite.py. Please let me know if I'm missing something: > > --- a/gluon/rewrite.py > +++ b/gluon/rewrite.py > @@ -213,9 +213,9 @@ > if redir == '!': > break > elif '?' in redir: > - url = redir + '&' + 'code=%s&ticket= > %s&requested_uri=%s' % (status,ticket, request.env.request_uri) > + url = redir + '&' + 'code=%s&ticket= > %s&requested_uri=%s&request_url=%s' % (status,ticket, > request.env.request_uri, request.url.text) > else: > - url = redir + '?' + 'code=%s&ticket= > %s&requested_uri=%s' % (status,ticket, request.env.request_uri) > + url = redir + '?' + 'code=%s&ticket= > %s&requested_uri=%s&request_url=%s' % (status,ticket, > request.env.request_uri, request.url.text) > return HTTP(303, > 'You are being redirected <a > href="%s">here</a>' % url, > Location=url)

