changeset 5659:80a7f3cd237b

deal with werkzeug 0.6.x behaviour change if redirect() gets unicode 0.5.x seems to happily accept both unicode and str and do same for both. 0.6.x does iri-to-uri transform if it gets unicode (including url-quoting). As our "unicode url" is already url-quoted, we just use str() to make it a str before giving it to werkzeug, so it behaves in the same way for werkzeug 0.5.x and 0.6.x.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 28 Apr 2010 12:29:55 +0200
parents 24d7e2f450bf
children 8ed0f132fb44
files MoinMoin/web/contexts.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/contexts.py	Fri Apr 23 21:19:18 2010 +0200
+++ b/MoinMoin/web/contexts.py	Wed Apr 28 12:29:55 2010 +0200
@@ -269,6 +269,10 @@
 
     def http_redirect(self, url, code=302):
         """ Raise a simple redirect exception. """
+        # werkzeug >= 0.6 does iri-to-uri transform if it gets unicode, but our
+        # url is already url-quoted, so we better give it str to have same behaviour
+        # with werkzeug 0.5.x and 0.6.x:
+        url = str(url) # if url is unicode, it should contain ascii chars only
         abort(redirect(url, code=code))
 
     def http_user_agent(self):