Skip to content

Commit

Permalink
setup: forward compatibility to itsdangerous>=2.1
Browse files Browse the repository at this point in the history
* itsdangerous v2.1 removed the jws functionality

* the jws functionality has been copy pasted to invenio-base to provide
  it further
  • Loading branch information
utnapischtim committed Nov 5, 2024
1 parent b1d7748 commit 2907f99
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions invenio_rdm_records/secret_links/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 TU Wien.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -11,13 +12,17 @@
from datetime import datetime

from flask import current_app
from itsdangerous import (
BadData,
JSONWebSignatureSerializer,
Serializer,
SignatureExpired,
TimedJSONWebSignatureSerializer,
)
from itsdangerous import BadData, Serializer, SignatureExpired

try:
# itsdangerous < 2.1.0
from itsdangerous import JSONWebSignatureSerializer, TimedJSONWebSignatureSerializer
except ImportError:
# itsdangerous >= 2.1.0
from invenio_base.jws import (
JSONWebSignatureSerializer,
TimedJSONWebSignatureSerializer,
)


class TokenSerializerMixin(Serializer):
Expand Down

0 comments on commit 2907f99

Please sign in to comment.