diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-09-30 17:33:07 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-09-30 20:33:18 -0400 |
| commit | 5091bb6a07caf4afe5d43c83a045c3f04a441dc3 (patch) | |
| tree | 49abbcf60182a89b3e97e93c046a26304ec92d86 | |
| parent | d6cec5f6ffd1b5dc906a85ecbb0ca8d11e6d494d (diff) | |
[2.0.x] Refs #27025, #28593 -- Fixed "invalid escape sequence" warnings in urls/resolvers.py.
Backport of f0ffa3f4ea277f9814285085fde20baff60fc386 from master
| -rw-r--r-- | django/urls/resolvers.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py index 4cd25ff075..e3d1062c97 100644 --- a/django/urls/resolvers.py +++ b/django/urls/resolvers.py @@ -119,7 +119,7 @@ class CheckURLMixin: # 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 regex_pattern.startswith(('/', '^/', '^\\/')) and not regex_pattern.endswith('/'): warning = Warning( "Your URL pattern {} has a route beginning with a '/'. Remove this " "slash as it is unnecessary. If this pattern is targeted in an " @@ -187,7 +187,7 @@ class RegexPattern(CheckURLMixin): _PATH_PARAMETER_COMPONENT_RE = re.compile( - '<(?:(?P<converter>[^>:]+):)?(?P<parameter>\w+)>' + r'<(?:(?P<converter>[^>:]+):)?(?P<parameter>\w+)>' ) |
