diff options
| author | Adam Johnson <me@adamj.eu> | 2024-02-24 19:15:01 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-03-02 19:54:21 +0100 |
| commit | 71d5eafb05a19287d954847beb33e4eeca65b4c4 (patch) | |
| tree | 448615896f0dec9e397fc7be7c329a4c9b152947 /django/urls | |
| parent | 5dfcf343cd414d3f7a33dabb763b4478fa081d72 (diff) | |
Fixed #35250 -- Made URL system checks use uncompiled regexes.
Diffstat (limited to 'django/urls')
| -rw-r--r-- | django/urls/resolvers.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py index e335fc0a58..1b26aed8c1 100644 --- a/django/urls/resolvers.py +++ b/django/urls/resolvers.py @@ -169,12 +169,11 @@ class CheckURLMixin: """ Check that the pattern does not begin with a forward slash. """ - regex_pattern = self.regex.pattern if not settings.APPEND_SLASH: # Skip check as it can be useful to start a URL pattern with a slash # when APPEND_SLASH=False. return [] - if regex_pattern.startswith(("/", "^/", "^\\/")) and not regex_pattern.endswith( + if self._regex.startswith(("/", "^/", "^\\/")) and not self._regex.endswith( "/" ): warning = Warning( @@ -224,8 +223,7 @@ class RegexPattern(CheckURLMixin): return warnings def _check_include_trailing_dollar(self): - regex_pattern = self.regex.pattern - if regex_pattern.endswith("$") and not regex_pattern.endswith(r"\$"): + if self._regex.endswith("$") and not self._regex.endswith(r"\$"): return [ Warning( "Your URL pattern {} uses include with a route ending with a '$'. " |
