Merge "Regular expressions need to be written as // to conforms to pep8"

This commit is contained in:
Zuul 2023-06-13 11:15:43 +00:00 committed by Gerrit Code Review
commit 5741ade9d7
2 changed files with 2 additions and 2 deletions

View File

@ -206,7 +206,7 @@ def get_request_url(request):
forwarded = headers.get('X-Forwarded-Host')
if forwarded:
url_parts = list(parse.urlsplit(url))
url_parts[1] = re.split(',\s?', forwarded)[-1]
url_parts[1] = re.split(',\\s?', forwarded)[-1]
url = parse.urlunsplit(url_parts).rstrip('/')
return url

View File

@ -391,7 +391,7 @@ def sanitize_hostname(hostname):
hostname = hostname.decode('latin-1')
hostname = re.sub('[ _]', '-', hostname)
hostname = re.sub('[^\w.-]+', '', hostname)
hostname = re.sub('[^\\w.-]+', '', hostname)
hostname = hostname.lower()
hostname = hostname.strip('.-')