mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2026-02-04 10:14:15 +02:00
requires_authorization now takes async views
This commit is contained in:
@@ -14,4 +14,4 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
__version__ = "0.2.0"
|
__version__ = "0.2.1"
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ def requires_authorization(view):
|
|||||||
# TODO: Add support to validate scopes.
|
# TODO: Add support to validate scopes.
|
||||||
|
|
||||||
@functools.wraps(view)
|
@functools.wraps(view)
|
||||||
def wrapper(*args, **kwargs):
|
async def wrapper(*args, **kwargs):
|
||||||
if not current_app.discord.authorized:
|
if not current_app.discord.authorized:
|
||||||
raise exceptions.Unauthorized
|
raise exceptions.Unauthorized
|
||||||
return view(*args, **kwargs)
|
return await view(*args, **kwargs)
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|||||||
Reference in New Issue
Block a user