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

Properly upgrade to Django 2.2 #2315

Merged
merged 4 commits into from
Nov 26, 2021
Merged

Conversation

hmpf
Copy link
Contributor

@hmpf hmpf commented Oct 22, 2021

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 to six.moves. When 2.2 is no longer supported this file can be removed after updating to the modern locations: lru_cache from functools, force_str/smart_str from django.utils.encoding.

hmpf added 3 commits October 22, 2021 09:54
* 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.
@github-actions
Copy link

github-actions bot commented Oct 22, 2021

Test results

       6 files         6 suites   8m 15s ⏱️
2 800 tests 2 704 ✔️   96 💤 0
5 600 runs  5 408 ✔️ 192 💤 0

Results for commit 08da316.

♻️ This comment has been updated with latest results.

@hmpf hmpf mentioned this pull request Oct 22, 2021
Copy link
Member

@lunkwill42 lunkwill42 left a 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...

python/nav/compatibility.py Outdated Show resolved Hide resolved
python/nav/compatibility.py Outdated Show resolved Hide resolved
@hmpf hmpf requested a review from lunkwill42 November 25, 2021 12:04
@hmpf
Copy link
Contributor Author

hmpf commented Nov 26, 2021

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.

@lunkwill42 lunkwill42 added this to the 5.3.0 milestone Nov 26, 2021
@lunkwill42 lunkwill42 merged commit 95089b3 into Uninett:master Nov 26, 2021
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.

2 participants