-
Notifications
You must be signed in to change notification settings - Fork 39
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
Properly upgrade to Django 2.2 #2315
Conversation
* Use Python's own lru_cache if available lru_cache() was added to functools in Python 3.2. * Rename (force|smart)_text to (force|smart)_str Django 2.2 has *_text, Django 3.2 has both, Django 4.0 has *_str. Gets rid of a warning.
We no longer need support Django older than 2.2, so switch to the header access method introduced in Django 1.11.
8cbb01e
to
d1adb0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks clean and proper to me, except the minor typos that don't seem to have test coverage...
I made a PR #2330 to ensure that no syntax errors or missing imports are ever commited. I don't think it is a test's job to ensure there are no typos when there are faster and better ways to find and prevent them. |
While the code currently runs on 2.2, it is not doing everything as 2.2 would prefer.
Merging this PR will improve code quality on 2.2 and prevent exceptions on 3.2.
A new module
nav.compatibility
is introduced, to do some conditional imports in a single location, similar tosix.moves
. When 2.2 is no longer supported this file can be removed after updating to the modern locations:lru_cache
fromfunctools
,force_str
/smart_str
fromdjango.utils.encoding
.