diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2019-06-29 17:06:55 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-29 17:06:55 +1000 |
commit | f40a7dc41fdd738a74546ff22b110a4c8ab850fe (patch) | |
tree | cffd024f1df8ea8217bb3b24a71c36a88a0e85af /synapse/rest/media/v1/config_resource.py | |
parent | Merge pull request #5576 from matrix-org/babolivier/3pid-invite-ratelimit (diff) | |
download | synapse-f40a7dc41fdd738a74546ff22b110a4c8ab850fe.tar.xz |
Make the http server handle coroutine-making REST servlets (#5475)
Diffstat (limited to 'synapse/rest/media/v1/config_resource.py')
-rw-r--r-- | synapse/rest/media/v1/config_resource.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/synapse/rest/media/v1/config_resource.py b/synapse/rest/media/v1/config_resource.py index fa3d6680fc..9f747de263 100644 --- a/synapse/rest/media/v1/config_resource.py +++ b/synapse/rest/media/v1/config_resource.py @@ -14,31 +14,28 @@ # limitations under the License. # -from twisted.internet import defer -from twisted.web.resource import Resource from twisted.web.server import NOT_DONE_YET -from synapse.http.server import respond_with_json, wrap_json_request_handler +from synapse.http.server import ( + DirectServeResource, + respond_with_json, + wrap_json_request_handler, +) -class MediaConfigResource(Resource): +class MediaConfigResource(DirectServeResource): isLeaf = True def __init__(self, hs): - Resource.__init__(self) + super().__init__() config = hs.get_config() self.clock = hs.get_clock() self.auth = hs.get_auth() self.limits_dict = {"m.upload.size": config.max_upload_size} - def render_GET(self, request): - self._async_render_GET(request) - return NOT_DONE_YET - @wrap_json_request_handler - @defer.inlineCallbacks - def _async_render_GET(self, request): - yield self.auth.get_user_by_req(request) + async def _async_render_GET(self, request): + await self.auth.get_user_by_req(request) respond_with_json(request, 200, self.limits_dict, send_cors=True) def render_OPTIONS(self, request): |