summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-09-30 17:33:07 -0700
committerTim Graham <timograham@gmail.com>2017-09-30 20:33:07 -0400
commitf0ffa3f4ea277f9814285085fde20baff60fc386 (patch)
treee23c945c6047dbbb36745183deed1d41446bc5ad
parent41406bf98e64917e5804cdc6338f70f212c365d4 (diff)
Refs #27025, #28593 -- Fixed "invalid escape sequence" warnings in urls/resolvers.py.
-rw-r--r--django/urls/resolvers.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py
index b214264445..b41434f61c 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+)>'
)