summaryrefslogtreecommitdiffstats
path: root/accounts/utils/confirmation.py
diff options
context:
space:
mode:
authorJonah Brüchert <jbb@kaidan.im>2024-03-29 02:20:41 +0100
committerJonah Brüchert <jbb@kaidan.im>2024-03-29 02:23:00 +0100
commit39230732099298b7f56c60b396949d8c0484e4dc (patch)
treed2fc00ccd36783183927fcb90b748641ed588e1d /accounts/utils/confirmation.py
parentdcad1d5ca832ea05ababa3d38de9a82fc361f2ba (diff)
downloadweb-39230732099298b7f56c60b396949d8c0484e4dc.tar.gz
web-39230732099298b7f56c60b396949d8c0484e4dc.tar.bz2
web-39230732099298b7f56c60b396949d8c0484e4dc.zip
Format project
To allow automatically formatting changes in the future. Command used: black -l 79 accounts/
Diffstat (limited to 'accounts/utils/confirmation.py')
-rw-r--r--accounts/utils/confirmation.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/accounts/utils/confirmation.py b/accounts/utils/confirmation.py
index 60967de..62f14ad 100644
--- a/accounts/utils/confirmation.py
+++ b/accounts/utils/confirmation.py
@@ -10,13 +10,16 @@ class Confirmation(URLSafeTimedSerializer):
def __init__(self, realm: str, key=None, **kwargs):
if key is None:
- key = accounts_app.config['SECRET_KEY']
+ key = accounts_app.config["SECRET_KEY"]
super(Confirmation, self).__init__(key, salt=realm, **kwargs)
- def loads_http(self, s: Union[str, bytes],
- max_age: Optional[int] = None,
- return_timestamp: bool = False,
- salt: Optional[bytes] = None) -> Any:
+ def loads_http(
+ self,
+ s: Union[str, bytes],
+ max_age: Optional[int] = None,
+ return_timestamp: bool = False,
+ salt: Optional[bytes] = None,
+ ) -> Any:
"""
Like `Confirmation.loads`, but raise HTTP exceptions with appropriate
messages instead of `BadSignature` or `SignatureExpired`.
@@ -25,6 +28,6 @@ class Confirmation(URLSafeTimedSerializer):
try:
return self.loads(s, max_age, return_timestamp, salt)
except BadSignature:
- raise Forbidden('Ungültiger Bestätigungslink.')
+ raise Forbidden("Ungültiger Bestätigungslink.")
except SignatureExpired:
- raise Forbidden('Bestätigungslink ist zu alt.')
+ raise Forbidden("Bestätigungslink ist zu alt.")