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

Fix deprecation: Change force_text to force_str #123

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

bufke
Copy link
Contributor

@bufke bufke commented Dec 7, 2021

This is not a breaking change for Python 3. force_str has existed at least as far back as Django 1.8.

If Python 2 support is needed, then this could break it. IMO it shouldn't be supported but if preferred I can wrap this in a try catch.

@bufke bufke mentioned this pull request Dec 7, 2021
@timabbott
Copy link
Collaborator

How does this change work? I only see the import statement changed, not any use.

@bufke
Copy link
Contributor Author

bufke commented Dec 7, 2021

Oh that was a mistake. Sorry. Fixed.

@pcarn
Copy link
Contributor

pcarn commented Dec 8, 2021

The declaration of python 2 support should be removed if it's going to be knowingly broken.
https://github.com/disqus/django-bitfield/blob/master/setup.py#L52-L53

Or conditionally change the import/usage based on the python version

@bufke
Copy link
Contributor Author

bufke commented Dec 8, 2021

I'm happy to update the PR to check Python version or remove claimed python 2 support. Just let me know. Personally I'm in favor of dropping Python 2, clearly Django itself is not interested in supporting even python 2 friendly aliases.

@timabbott
Copy link
Collaborator

timabbott commented Dec 9, 2021 via email

@bufke
Copy link
Contributor Author

bufke commented Dec 10, 2021

Ok I removed python 2 from setup.py and tox.ini. Sadly it looks like travis ci is no longer running so I can't confirm this setup would pass CI (it should). Python 3 tests pass locally for me using a python:3.10 Docker image. I had to increment the psycopg2 version tox uses to get it to build.

I would appreciate if a maintainer could give this a review and ensure tests still pass.

@bufke
Copy link
Contributor Author

bufke commented Jan 6, 2022

For demonstration/convenience purposes, I submitted https://pypi.org/project/django-bitfield-4-0/ for anyone looking to use django-bitfield in django 4.0. This package will not be maintained so please only use it as a stop gap measure.

@timabbott
Copy link
Collaborator

Thanks, this is appreciated. I am very busy this month but expect to be able to review this carefully in April.

Python 2 hasn't had security support for some time; anyone needing it
can run an old version of django-bitfield.

This allows us to use drop use of `force_text` in favor of
`force_str`, fixing deprecation issues with Django 4.

Fixes disqus#122.
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.

None yet

3 participants