Refs #27025, #28593 -- Fixed "invalid escape sequence" warnings in urls/resolvers.py.

This commit is contained in:
Jon Dufresne 2017-09-30 17:33:07 -07:00 committed by Tim Graham
parent 41406bf98e
commit f0ffa3f4ea
1 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ class CheckURLMixin:
# Skip check as it can be useful to start a URL pattern with a slash # Skip check as it can be useful to start a URL pattern with a slash
# when APPEND_SLASH=False. # when APPEND_SLASH=False.
return [] return []
if regex_pattern.startswith(('/', '^/', '^\/')) and not regex_pattern.endswith('/'): if regex_pattern.startswith(('/', '^/', '^\\/')) and not regex_pattern.endswith('/'):
warning = Warning( warning = Warning(
"Your URL pattern {} has a route beginning with a '/'. Remove this " "Your URL pattern {} has a route beginning with a '/'. Remove this "
"slash as it is unnecessary. If this pattern is targeted in an " "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( _PATH_PARAMETER_COMPONENT_RE = re.compile(
'<(?:(?P<converter>[^>:]+):)?(?P<parameter>\w+)>' r'<(?:(?P<converter>[^>:]+):)?(?P<parameter>\w+)>'
) )