Django-Verify-Email icon indicating copy to clipboard operation
Django-Verify-Email copied to clipboard

Django-Verify-Email is not compatible anymore with Django 5.1

Open leolivier opened this issue 1 year ago • 2 comments

Moving from Django 5.0.8 to 5.1 triggers the following exception:

File "/home/olivi/devt/cousins-matter/members/views/views_registration.py", line 76, in post
    send_verification_email(request, form)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/verify_email/email_handler.py", line 98, in send_verification_email
    return _VerifyEmail().send_verification_link(request, form)
           ^^^^^^^^^^^^^^
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/verify_email/email_handler.py", line 19, in __init__
    self.token_manager = TokenManager()
                         ^^^^^^^^^^^^^^
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/verify_email/token_manager.py", line 53, in __init__
    super().__init__(key, sep, salt)
TypeError: Signer.__init__() takes 1 positional argument but 4 were given

Unfortunately, I'm not sure this project is still maintained...

leolivier avatar Aug 08 '24 15:08 leolivier

Looking at the code, Django-Verify-Email defines a class TokenManager which derives from django.core.signing.TimestampSigner which itself derives from django.core.signing.Signer and this Signer class contains the following comment:

class Signer:
    # RemovedInDjango51Warning: When the deprecation ends, replace with:
    # def __init__(
    #   self, *, key=None, sep=":", salt=None, algorithm=None, fallback_keys=None
    # ):
    def __init__(
        self,
        *args,
        key=None,
        sep=":",
        salt=None,
        algorithm=None,
        fallback_keys=None,
    ):

So I suppose we can change the faulty line super().init(key, sep, salt) by super().init(key=key, sep=sep, salt=salt)

leolivier avatar Aug 08 '24 15:08 leolivier

closed with PR https://github.com/foo290/Django-Verify-Email/pull/88

leolivier avatar Aug 10 '24 10:08 leolivier

yea, saw it, fixed it btw, but thanks a lot for this, its been a while since I worked on this package

knownbug06 avatar Nov 03 '24 16:11 knownbug06