-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
@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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... or await
There was a problem hiding this 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): |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
Based on #6195