mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Replaced and...or... constructs with PEP 308 conditional expressions.
This commit is contained in:
@@ -85,7 +85,7 @@ class CommonMiddleware(object):
|
||||
return
|
||||
if new_url[0]:
|
||||
newurl = "%s://%s%s" % (
|
||||
request.is_secure() and 'https' or 'http',
|
||||
'https' if request.is_secure() else 'http',
|
||||
new_url[0], urlquote(new_url[1]))
|
||||
else:
|
||||
newurl = urlquote(new_url[1])
|
||||
|
||||
@@ -49,7 +49,7 @@ class LocaleMiddleware(object):
|
||||
|
||||
if path_valid:
|
||||
language_url = "%s://%s/%s%s" % (
|
||||
request.is_secure() and 'https' or 'http',
|
||||
'https' if request.is_secure() else 'http',
|
||||
request.get_host(), language, request.get_full_path())
|
||||
return HttpResponseRedirect(language_url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user