Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace change in django_recaptcha library as of 4.0: captcha changed to django_recaptcha #50

Closed
wants to merge 2 commits into from

Conversation

DanielSwain
Copy link
Contributor

No description provided.

@wadevries
Copy link

Context: https://github.com/torchbox/django-recaptcha/releases/tag/4.0.0

Package namespace renamed!

The package namespace captcha has been renamed to django_recaptcha to avoid conflicts with other captcha packages.

Please see the full CHANGELOG for all changes and upgrade considerations

@loicteixeira
Copy link
Contributor

@DanielSwain If you're modifying the import, I reckon the requirements in setup.py be updated as well to only install >=4? Otherwise, make the imports work with both versions (assuming everything else is compatible?) like so:

try:
    from django_captcha.fields import ReCaptchaField  # >= 4.0
except ImportError:
    from captcha.fields import ReCaptchaField  # < 4.0

Until this is merged, I reckon you can add django_recaptcha < 4 in your own requirements.

@tacitus @haydngreatnews Do you think someone can look at this issue, this is breaking some builds.

Copy link

@enzedonline enzedonline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with previous review - the import needs to be wrapped in a try/except with fallback to pre-4 captcha namespace:

try:
    from django_recaptcha.fields import ReCaptchaField
except ImportError:
    from captcha.fields import ReCaptchaField

The widget syntax has changed in django-recaptcha also, upgrading that package needs to be a conscious, planned decision for people supplying parameters to the underlying widget.

@haydngreatnews
Copy link
Member

haydngreatnews commented Nov 20, 2023

Hi there, thanks for the contribution. Seeing as the interface to the widget has also changed, I think we should probably set a maximum version in the dependencies for this case, and make a point release.

I'll get started down that road now, and then look into merging #49 for a better time down the road, also.

Until then, I think @loicteixeira's suggestion, of setting the requirement explicitly in your project would be the best option.

@DanielSwain DanielSwain changed the title Import from django_recaptcha instead of captcha Namespace change in django_recaptcha library as of 4.0: captcha changed to django_recaptcha Nov 20, 2023
@DanielSwain
Copy link
Contributor Author

DanielSwain commented Nov 28, 2023

With the cloning of this repo by Torchbox into Torchbox Forks, it appears that Torchbox will now be maintaining wagtail-django-recaptcha. Their just-released version addresses the django_recaptcha namespace problem. Therefore, I'm closing this PR with an additional note to @thibaudcolas and @brylie that the PyPI project has not yet been updated.

Note: The Installation section on PyPI mentions cloning from Springload's private repo rather than using pip install wagtail-django-recaptcha.

@thibaudcolas
Copy link
Contributor

thibaudcolas commented Dec 8, 2023

@DanielSwain Torchbox isn’t maintaining wagtail-django-recaptcha. We do have @katdom13 from Torchbox contributing to this project via maintenance-related PRs like #49. I work for Torchbox and have access to the package on PyPI but only because I used to help maintain this project at Springload years ago. Please see our description of the purpose of torchbox-forks for more info about our fork.

So I’d recommend keeping this PR open. Regardless of who maintains the package, they’ll benefit from this work.


And as far as future maintenance of this package, let’s keep chatting in #51 ?

@DanielSwain
Copy link
Contributor Author

Reopening per the comment from @thibaudcolas above.

@DanielSwain DanielSwain reopened this Dec 8, 2023
@raudu
Copy link

raudu commented Jan 24, 2024

Hello everyone, any ideas when this will be fixed or can a workaround be provided?

@enzedonline
Copy link

Hello everyone, any ideas when this will be fixed or can a workaround be provided?

The workaround is above. Go into the package folder in your virtual environment, edit forms.py and update the import manually until this is resolved.

#50 (review)

@enzedonline
Copy link

@brylie Any chance you could review this - it seems you're the only one with access to do this

@seanpaulharsevoort
Copy link

As of 14th opf September 2024 the issue still remains. Any news on of this is going to be fixed?

@haydngreatnews
Copy link
Member

haydngreatnews commented Sep 15, 2024

This package has been updated as of v2.1.1 to support django-recaptcha 4+, and drop support for previous versions

If you have a particular need to run django-recaptcha < 3, then I would recommend you use an older version of this package, or specifically state your case here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants