Skip to content

Commit

Permalink
fix async/await consentresource (matrix-org#5585)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl authored Jul 1, 2019
1 parent 04196a4 commit b491468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/5585.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Synapse can now handle RestServlets that return coroutines.
4 changes: 3 additions & 1 deletion synapse/rest/consent/consent_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import jinja2
from jinja2 import TemplateNotFound

from twisted.internet import defer

from synapse.api.errors import NotFoundError, StoreError, SynapseError
from synapse.config import ConfigError
from synapse.http.server import (
Expand Down Expand Up @@ -139,7 +141,7 @@ async def _async_render_GET(self, request):
else:
qualified_user_id = UserID(username, self.hs.hostname).to_string()

u = await self.store.get_user_by_id(qualified_user_id)
u = await defer.maybeDeferred(self.store.get_user_by_id, qualified_user_id)
if u is None:
raise NotFoundError("Unknown user")

Expand Down

0 comments on commit b491468

Please sign in to comment.