diff options
author | Erik Johnston <erik@matrix.org> | 2016-03-23 16:54:59 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-03-23 16:54:59 +0000 |
commit | 647b041d1af28a04004cda42a354259ef7cdc479 (patch) | |
tree | dccf33e860071251238ccdf5c1b6dbab9270e6eb /synapse/http/server.py | |
parent | Merge pull request #664 from matrix-org/erikj/public_room_list (diff) | |
parent | Simplify intern_dict (diff) | |
download | synapse-647b041d1af28a04004cda42a354259ef7cdc479.tar.xz |
Merge pull request #666 from matrix-org/erikj/intern
Intern lots of strings
Diffstat (limited to 'synapse/http/server.py')
-rw-r--r-- | synapse/http/server.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py index b17b190ee5..b82196fd5e 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -18,6 +18,7 @@ from synapse.api.errors import ( cs_exception, SynapseError, CodeMessageException, UnrecognizedRequestError, Codes ) from synapse.util.logcontext import LoggingContext, PreserveLoggingContext +from synapse.util.caches import intern_dict import synapse.metrics import synapse.events @@ -229,11 +230,12 @@ class JsonResource(HttpServer, resource.Resource): else: servlet_classname = "%r" % callback - args = [ - urllib.unquote(u).decode("UTF-8") if u else u for u in m.groups() - ] + kwargs = intern_dict({ + name: urllib.unquote(value).decode("UTF-8") if value else value + for name, value in m.groupdict().items() + }) - callback_return = yield callback(request, *args) + callback_return = yield callback(request, **kwargs) if callback_return is not None: code, response = callback_return self._send_response(request, code, response) |