springload / wagtail-django-recaptcha

A simple recaptcha field for Wagtail Form Pages
https://pypi.python.org/pypi/wagtail-django-recaptcha/
MIT License
56 stars 20 forks source link

`ugettext_lazy` is deprecated and will be removed in Django 4.0 #34

Closed tbrlpld closed 3 years ago

tbrlpld commented 3 years ago

Running a project depending on this library with Django >= 3.0 with deprecation warnings activated (e.g. python -Wa manage.py test) shows the following warnings for wagtail-django-recaptcha:

[...]/lib/python3.8/site-packages/captcha/fields.py:26: RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy().
  "captcha_invalid": _("Error verifying reCAPTCHA, please try again."),
[...]/lib/python3.8/site-packages/captcha/fields.py:27: RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy().
  "captcha_error": _("Error verifying reCAPTCHA, please try again."),

The solution is to simply remove the leading u in the method name, since that method is simply a alias for gettext_lazy: https://docs.djangoproject.com/en/3.2/releases/3.0/#id3

tbrlpld commented 3 years ago

Never mind me. This is not the correct package. This package does not use any "gettext" according to a quick search in the repo.