]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Unquote percent escapes in captured groups in the path component of the URI,
authorBen Darnell <bdarnell@beaker.local>
Fri, 9 Jul 2010 20:07:43 +0000 (13:07 -0700)
committerBen Darnell <bdarnell@beaker.local>
Fri, 9 Jul 2010 20:07:43 +0000 (13:07 -0700)
to be more consistent with our handling of query parameters.

This change is slightly backwards-incompatible:  applications that have
already added an unquote() call on arguments to RequestHandler.get/post
will need to remove them.

This change replaces an earlier (reverted) commit:
http://github.com/facebook/tornado/commit/7b80c2f4db226d6fa3a7f3dfa59277da1d642f91

tornado/web.py

index 7bd6f86bebcf422dcd80e963a680e59106022e9b..0e8c89a83e999bd5b6862288cefa28b465c177b0 100644 (file)
@@ -1064,11 +1064,12 @@ class Application(object):
                     # Pass matched groups to the handler.  Since
                     # match.groups() includes both named and unnamed groups,
                     # we want to use either groups or groupdict but not both.
-                    kwargs = match.groupdict()
+                    kwargs = dict((k, urllib.unquote(v))
+                                  for (k, v) in match.groupdict().iteritems())
                     if kwargs:
                         args = []
                     else:
-                        args = match.groups()
+                        args = [urllib.unquote(s) for s in match.groups()]
                     break
             if not handler:
                 handler = ErrorHandler(self, request, 404)