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

Change-Id: I6b0826cbddee06d08f07cae65478aeda25872ed5
This commit is contained in:
leiyuehui 2023-06-13 16:51:31 +08:00
parent 650ebbb269
commit f2b9fad25c
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('.-')