Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Move rest/admin to use async/await. #6196

Merged
merged 9 commits into from
Oct 18, 2019
Merged

Move rest/admin to use async/await. #6196

merged 9 commits into from
Oct 18, 2019

Conversation

erikjohnston
Copy link
Member

Based on #6195

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good otherwise, though it's going to conflict with #5742 and #5925 :(

synapse/rest/admin/__init__.py Outdated Show resolved Hide resolved
synapse/rest/admin/__init__.py Outdated Show resolved Hide resolved
@erikjohnston erikjohnston requested a review from a team October 11, 2019 15:13


@defer.inlineCallbacks
def assert_user_is_admin(auth, user_id):
async def assert_user_is_admin(auth, user_id):
"""Verify that the given user is an admin user

WARNING: MAKE SURE YOU YIELD ON THE RESULT!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... or await

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm



@attr.s(slots=True, frozen=True)
class DoneAwaitable(object):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you not use twisted.internet.defer.succeed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, hmm, true. Though given I've written it now and this is (presumably?) pretty fast I think I might leave it for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants