Remove redundant request_handler decorator
This is needless complexity; we might as well use the wrapper directly.
Also rename wrap_request_handler->wrap_json_request_handler.
2 files changed, 4 insertions, 9 deletions
diff --git a/synapse/http/additional_resource.py b/synapse/http/additional_resource.py
index 343e932cb1..d9e7f5dfb7 100644
--- a/synapse/http/additional_resource.py
+++ b/synapse/http/additional_resource.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from synapse.http.server import wrap_request_handler
+from synapse.http.server import wrap_json_request_handler
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
@@ -50,6 +50,6 @@ class AdditionalResource(Resource):
self._async_render(request)
return NOT_DONE_YET
- @wrap_request_handler
+ @wrap_json_request_handler
def _async_render(self, request):
return self._handler(request)
diff --git a/synapse/http/server.py b/synapse/http/server.py
index fd58e65c4b..f29e36f490 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -45,12 +45,7 @@ import simplejson
logger = logging.getLogger(__name__)
-def request_handler():
- """Decorator for ``wrap_request_handler``"""
- return wrap_request_handler
-
-
-def wrap_request_handler(h):
+def wrap_json_request_handler(h):
"""Wraps a request handler method with exception handling.
Also adds logging as per wrap_request_handler_with_logging.
@@ -213,7 +208,7 @@ class JsonResource(HttpServer, resource.Resource):
self._async_render(request)
return server.NOT_DONE_YET
- @request_handler()
+ @wrap_json_request_handler
@defer.inlineCallbacks
def _async_render(self, request):
""" This gets called from render() every time someone sends us a request.
|