[Zope] Re: Redirection and Request Variables
Evan Simpson
evan@4-am.com
Fri, 13 Jun 2003 13:17:00 -0500
Andreas Pakulat wrote:
> I've got a page template that display a file using the id given in the
> request. I also got login/logout functionality on the site using
> exUserFolder, now I want that If the user looks at the file display he
> can click the login and after that gets back to the file display page.
> But this doesn't work, After clicking on the login Button I get a
> KeyError about the variable which holds the id - after a reload
> everything is fine. The variable is encoded within the URL using the
> QUERY_STRING. Is it somehow possible to get rid of this error?
I've just checked a fix for this into the CVS trunk, and it's an easy
patch to apply if you're not a CVS user:
--- CMFCore/CookieCrumbler.py 6 Dec 2001 21:58:18 -0000 1.12
+++ CMFCore/CookieCrumbler.py 13 Jun 2003 18:16:04 -0000
@@ -233,6 +233,9 @@
came_from = req.get('came_from', None)
if came_from is None:
came_from = req['URL']
+ if req.get('QUERY_STRING'):
+ came_from = '%s?%s' % (came_from,
+ req['QUERY_STRING'])
url = '%s?came_from=%s&retry=%s' % (
page.absolute_url(), quote(came_from), retry)
return url