]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
coerce kwarg keys to str 454/head
authorMinRK <benjaminrk@gmail.com>
Thu, 2 Feb 2012 22:05:59 +0000 (14:05 -0800)
committerMinRK <benjaminrk@gmail.com>
Thu, 2 Feb 2012 22:05:59 +0000 (14:05 -0800)
If handler regex is unicode, the keys of groupdict are unicode, but should be
str, as Python < 2.6.5 does not accept unicode keys in:

    _execute(*args, **kwargs)

Since they are for keyword args, they will be valid identifiers, and thus ascii.

tornado/web.py

index c31eb674b2aa760bf9e6c17a74a2988cc5c144de..a065d8bcb511a3ed26be7f7db849f9ec29b34ac1 100644 (file)
@@ -1343,7 +1343,7 @@ class Application(object):
 
                         if spec.regex.groupindex:
                             kwargs = dict(
-                                (k, unquote(v))
+                                (str(k), unquote(v))
                                 for (k, v) in match.groupdict().iteritems())
                         else:
                             args = [unquote(s) for s in match.groups()]