summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorДилян Палаузов <dilyanpalauzov@users.noreply.github.com>2017-11-06 10:23:29 -0500
committerTim Graham <timograham@gmail.com>2017-11-07 09:08:46 -0500
commitc69e4bc69166b2d752b437a651dfa91f8b53ecfd (patch)
tree49cb2c1b54962eff1a02636062b213397003e7ed /django/core
parent00b93c2b1ecdda978f067309c6feafda633a7264 (diff)
Fixed #28769 -- Replaced 'x if x else y' with 'x or y'.
Diffstat (limited to 'django/core')
-rw-r--r--django/core/handlers/wsgi.py10
-rw-r--r--django/core/management/commands/makemessages.py8
2 files changed, 6 insertions, 12 deletions
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py
index 2ec6269bea..010e9acfbc 100644
--- a/django/core/handlers/wsgi.py
+++ b/django/core/handlers/wsgi.py
@@ -66,13 +66,9 @@ class LimitedStream:
class WSGIRequest(HttpRequest):
def __init__(self, environ):
script_name = get_script_name(environ)
- path_info = get_path_info(environ)
- if not path_info:
- # Sometimes PATH_INFO exists, but is empty (e.g. accessing
- # the SCRIPT_NAME URL without a trailing slash). We really need to
- # operate as if they'd requested '/'. Not amazingly nice to force
- # the path like this, but should be harmless.
- path_info = '/'
+ # If PATH_INFO is empty (e.g. accessing the SCRIPT_NAME URL without a
+ # trailing slash), operate as if '/' was requested.
+ path_info = get_path_info(environ) or '/'
self.environ = environ
self.path_info = path_info
# be careful to only replace the first slash in the path because of
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index 0151644a3a..f8c0da8388 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -323,9 +323,9 @@ class Command(BaseCommand):
raise CommandError("currently makemessages only supports domains "
"'django' and 'djangojs'")
if self.domain == 'djangojs':
- exts = extensions if extensions else ['js']
+ exts = extensions or ['js']
else:
- exts = extensions if extensions else ['html', 'txt', 'py']
+ exts = extensions or ['html', 'txt', 'py']
self.extensions = handle_extensions(exts)
if (locale is None and not exclude and not process_all) or self.domain is None:
@@ -501,9 +501,7 @@ class Command(BaseCommand):
locale_dir = path
break
if not locale_dir:
- locale_dir = self.default_locale_path
- if not locale_dir:
- locale_dir = NO_LOCALE_DIR
+ locale_dir = self.default_locale_path or NO_LOCALE_DIR
all_files.append(self.translatable_file_class(dirpath, filename, locale_dir))
return sorted(all_files)