From: Ben Darnell Date: Fri, 9 Jul 2010 20:07:43 +0000 (-0700) Subject: Unquote percent escapes in captured groups in the path component of the URI, X-Git-Tag: v1.0.0~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=557da3db1c912039bda9d0e54717e4bd23af8c9c;p=thirdparty%2Ftornado.git Unquote percent escapes in captured groups in the path component of the URI, 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 --- diff --git a/tornado/web.py b/tornado/web.py index 7bd6f86be..0e8c89a83 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -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)