Addons-server: Change django.conf.urls.url() to django.urls.path() in src/olympia/urls.py

Created on 29 Sep 2020  路  4Comments  路  Source: mozilla/addons-server

The old django.conf.urls.include() function is now importable from new django.urls.include() so it could be changed.
The old django.conf.urls.url() function could be replaced with new django.urls.path() function for routing .
The new django.urls.path() function allows a simpler, more readable URL routing syntax.
The django.conf.urls.url() function from previous versions is now available as django.urls.re_path(). The old location remains for backwards compatibility, without an imminent deprecation.
For Django-2.x , Its more efficient to use the latest path() and re_path() instead of url().

code quality maybe good first bug p5

Most helpful comment

Reviewing 25 PRs that do the exact same thing to a different file is not easier to review than a single PR that updates the 25 files in one go. It's slightly easier to merge, but we don't change urls.py that often.

All 4 comments

Next time when filing such issues please also include links to documentation (In this case https://docs.djangoproject.com/en/3.1/ref/urls/#url is a good start). It would be useful everywhere, not just in src/olympia/urls.py - that's a lot of files to change, but we should do it in one go.

@diox Wouldn't it be easier for you to review and merge if it were to be done in smaller steps than making all the changes in one go?

@diox So, I'll land a PR after making these changes in all the required urls.py.

Reviewing 25 PRs that do the exact same thing to a different file is not easier to review than a single PR that updates the 25 files in one go. It's slightly easier to merge, but we don't change urls.py that often.

Was this page helpful?
0 / 5 - 0 ratings