Open yarin-zhang opened 5 months ago
Same problem here with an old project...
We are currently migrating to Poetry, which supports git dependencies. I'll go with this solution for now:
[tool.poetry.dependencies]
# ...
django-hashers-passlib = { git = "https://github.com/mathiasertl/django-hashers-passlib.git" }
I forked the project and named it django-hashers-passlib-revived. It has support for up to Python 3.12 and Django 5.0.
I've been using this module to add pbkdf2_sha256 support for my Django project.
However, when I upgraded Django from 3.2 to 4.2, I encountered a problem due to the deprecation of
ugettext_noop
in Django 4.2, which caused errors in the project. Aside from this, Passlib worked well without any other issues.Since both this project and its dependency, passlib, invoked
ugettext_noop
, it seemed that simply updating the reference tougettext_noop
(actually just replacingugettext_noop
withgettext_noop
) might solve the problem.But I found that both libraries haven't been updated for a while, and just submitting a PR here wouldn't fix the issues in both libraries. So, I tried using a patching approach to address this issue and am sharing it for others who might encounter the same problem.
My Approach
You'll need to create a new app, for example,
passlib_patch
, and then add apatches.py
file.Then add the following code in
apps.py
:And add in
__init__.py
:I wrote a
tests.py
file and passed the tests.I can't guarantee that this code will work for everyone, but this patch did fix the error for me.
If there are any questions, feel free to discuss.