mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2025-12-09 20:09:30 +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.
|
||||
|
||||
@functools.wraps(view)
|
||||
def wrapper(*args, **kwargs):
|
||||
async def wrapper(*args, **kwargs):
|
||||
if not current_app.discord.authorized:
|
||||
raise exceptions.Unauthorized
|
||||
return view(*args, **kwargs)
|
||||
return await view(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
Reference in New Issue
Block a user