summaryrefslogtreecommitdiff
path: root/django/urls/resolvers.py
AgeCommit message (Collapse)Author
2025-12-26Fixed #36796 -- Handled lazy routes correctly in RoutePattern.match().kundan223
Coerce lazy route values to `str` at match time to support prefix and endpoint matching when using `gettext_lazy()` route paths. Regression in f920937c8a63df6bea220e4386f59cdb45b2e355. Thanks to Andrea Angelini for the report, and to Jake Howard and Jacob Walls for reviews. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-05-13Fixed #35518 -- Optimized RoutePattern by using string operations for ↵Jake Howard
converter-less routes.
2025-03-31Refs #28909 -- Simplified code using unpacking generalizations.Aarni Koskela
2024-03-05Fixed #35252 -- Optimized _route_to_regex().Adam Johnson
co-authored-by: Nick Pope <nick@nickpope.me.uk>
2024-03-02Fixed #35250 -- Made URL system checks use uncompiled regexes.Adam Johnson
2024-03-02Refs #35250 -- Avoided double conversion in RoutePattern.Adam Johnson
2024-02-19Fixed #35229 -- Made URL custom error handler check run once.Adam Johnson
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-07-11Refs #34691 -- Optimized system check for unmatched angle brackets in path().Mariusz Felisiak
Follow up to d1855c4847215f3afe3708736be13388bb6437eb.
2023-07-11Fixed #34691 -- Added system check for unmatched angle brackets in path().Amir Karimi
2023-05-02Fixed #34515 -- Made LocaleMiddleware prefer language from paths when i18n ↵Mariusz Felisiak
patterns are used. Regression in 94e7f471c4edef845a4fe5e3160132997b4cca81. This reverts commit 94e7f471c4edef845a4fe5e3160132997b4cca81 (refs #34069) and partly reverts commit 3b4728310a7a64f8fcc548163b0aa5f98a5c78f5. Thanks Anthony Baillard for the report. Co-Authored-By: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2023-04-10Fixed #34455 -- Restored i18n_patterns() respect of prefix_default_language ↵sarahboyce
argument when fallback language is used. Regression in 94e7f471c4edef845a4fe5e3160132997b4cca81. Thanks Oussama Jarrousse for the report.
2023-01-18Refs #34233 -- Used @functools.cache.Nick Pope
Python 3.9+ supports @functools.cache as an alias for @functools.lru_cache(maxsize=None).
2023-01-18Refs #34233 -- Used str.removeprefix()/removesuffix().Mariusz Felisiak
2022-10-04Fixed CVE-2022-41323 -- Prevented locales being interpreted as regular ↵Adam Johnson
expressions. Thanks to Benjamin Balder Bach for the report.
2022-09-01Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved internal ↵Mariusz Felisiak
URLResolver view-strings mapping to admindocs." This reverts commit 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1. Thanks Tom Carrick and Greg Kaleka for reports.
2022-05-17Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs.Alokik Vijay
Moved the functionality of URLResolver._is_callback(), URLResolver._callback_strs, URLPattern.lookup_str() to django.contrib.admindocs.
2022-03-29Fixed #16406 -- Added ResolveMatch.captured_kwargs and extra_kwargs.Alokik Vijay
Thanks Florian Apolloner for the review and implementation idea.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-01-10Fixed #33426 -- Fixed ResolverMatch.__repr_() for class-based views.Keryn Knight
Regression in 7c08f26bf0439c1ed593b51b51ad847f7e262bc1.
2021-12-07Fixed #30530, CVE-2021-44420 -- Fixed potential bypass of an upstream access ↵Florian Apolloner
control based on URL paths. Thanks Sjoerd Job Postmus and TengMA(@te3t123) for reports.
2021-07-29Fixed #23895 -- Prevented pickling of ResolverMatch.Jonathan Davis
Pickling a ResolverMatch did not work correctly in many cases, especially with CBVs and URLResolvers in the list of tried URL paths.
2021-06-22Fixed #32870 -- Improved error message when URLconf is empty.Igor Fernandes
2021-06-09Fixed #32195 -- Added system check for invalid view in path() and improved ↵Angus Holder
error messages.
2021-03-30Refs #32260 -- Made admindocs and technical 404 debug page use ↵Adam Johnson
view_func.view_class. Internals of admindocs and technical 404 debug page should use the view_class attribute and do not rely on __name__.
2021-03-29Fixed #32572 -- Improved ResolverMatch.__repr__().Nick Pope
When a partial function was passed as the view, the __repr__() would show the `func` argument as `functools.partial` which isn't very helpful, especially as it doesn't reveal the underlying function or arguments provided.
2021-01-11Refs #31791 -- Improved performance of URLResolver.resolve().David Smith
Performance regression in 11ebc6479ffda87376b60c9475d33d8120f86368.
2020-09-07Fixed #31791 -- Made technical 404 debug page display the tried URL patterns ↵Jon Dufresne
for Http404.
2020-09-02Fixed #31858 -- Reallowed whitespaces in URL paths outside of parameters.Tim Park
Regression in 22394bd3a18a7d9a8957a0b431f8ae4e5ca03a8c. Thanks David Smith for the review.
2020-06-22Removed unused param_dict return from URLResolver.resolve_error_handler().Adam Johnson
Unused since its introduction in ed114e15106192b22ebb78ef5bf5bce72b419d13.
2020-05-11Refs #30116 -- Simplified regex match group access with Match.__getitem__().Jon Dufresne
The method has been available since Python 3.6. The shorter syntax is also marginally faster.
2020-04-27Removed unnecessary tuple wrapping of single format string argument.François Freitag
2020-04-15Fixed #31459 -- Fixed handling invalid indentifiers in URL path conversion.Adam Johnson
This patch adjusted existing tests that used invalid identifiers.
2020-01-17Fixed #31166 -- Used "raise from" when raising ImproperlyConfigured ↵Ram Rachum
exceptions in django.urls.resolvers. This change sets the __cause__ attribute to raised exceptions and makes small cleanups in error messages.
2020-01-09Fixed #30995 -- Allowed converter.to_url() to raise ValueError to indicate ↵Jack Cushman
no match.
2019-12-06Fixed #31061 -- Ignored positional args in django.urls.resolve() when all ↵Mariusz Felisiak
optional named parameters are missing. Regression in 76b993a117b61c41584e95149a67d8a1e9f49dd1. Thanks Claude Paroz for the report and Carlton Gibson for reviews.
2019-10-29Fixed #30899 -- Lazily compiled import time regular expressions.Hasan Ramezani
2019-08-20Fixed #29667 -- Prohibited whitespaces in path() URLs.Hasan Ramezani
2019-07-03Fixed #29744 -- Fixed caching of URLResolver for a default URLconf.Benjamin Woodruff
get_resolver() for a default URLconf (passing no argument) and for settings.ROOT_URLCONF should return the same cached object.
2019-06-24Fixed #26431 -- Prevented django.urls.resolve() from returning missing ↵daniel a rios
optional parameters. Previous behavior was inconsistent with django.urls.reverse() and caused that translate_url() created an incorrect URL when an optional parameter was missing.
2019-06-20Fixed #30451 -- Added ASGI handler and coroutine-safety.Andrew Godwin
This adds an ASGI handler, asgi.py file for the default project layout, a few async utilities and adds async-safety to many parts of Django.
2019-04-25Fixed #30318 -- Added check for importability of arguments of custom error ↵Alasdair Nicol
handler views. Thanks to Jon on Stack Overflow for reporting the issue.
2018-12-06Fixed #28766 -- Added ResolverMatch.route.Benjamin Wohlwend
Co-Authored-By: Xavier Fernandez <xavier.fernandez@polyconseil.fr>
2018-10-04Fixed #29775 -- Fixed URL converters in a nested namespaced path.Eric Brandwein
When using include() without namespaces of some urlpatterns that have an include() with namespace, the converters of the parent include() weren't being used to convert the arguments of reverse().
2018-09-14Fixed #29642 -- Added check for arguments of custom error handler views.Adam Johnson
2018-08-01Fixed CVE-2018-14574 -- Fixed open redirect possibility in CommonMiddleware.Andreas Hug
2018-05-26Fixed #29415 -- Fixed detection of custom URL converters in included patterns.Xaroth Brook
2018-01-03Fixed #28982 -- Simplified code with and/or.Дилян Палаузов