summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-01-31 07:35:08 -0800
committerTim Graham <timograham@gmail.com>2018-01-31 10:35:08 -0500
commit6b2f8fb91c7adab123156e185db2efe31e41b628 (patch)
treeaec300a9ff055e274d52f0243bc670d0735da58a
parentf427ffcccbb29550d18eff4ee255e278157b240d (diff)
Refs #27795 -- Replaced force_text() usage in django.core.management.
Use decode() since Popen.communicate() always returns bytes.
-rw-r--r--django/core/management/__init__.py3
-rw-r--r--django/core/management/utils.py6
2 files changed, 4 insertions, 5 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index 2500d0b70e..9a565a9393 100644
--- a/django/core/management/__init__.py
+++ b/django/core/management/__init__.py
@@ -14,7 +14,6 @@ from django.core.management.base import (
)
from django.core.management.color import color_style
from django.utils import autoreload
-from django.utils.encoding import force_text
def find_commands(management_dir):
@@ -117,7 +116,7 @@ def call_command(command_name, *args, **options):
for s_opt in parser._actions if s_opt.option_strings
}
arg_options = {opt_mapping.get(key, key): value for key, value in options.items()}
- defaults = parser.parse_args(args=[force_text(a) for a in args])
+ defaults = parser.parse_args(args=[str(a) for a in args])
defaults = dict(defaults._get_kwargs(), **arg_options)
# Raise an error if any unknown options were passed.
stealth_options = set(command.base_stealth_options + command.stealth_options)
diff --git a/django/core/management/utils.py b/django/core/management/utils.py
index 56438b6455..df61bec26f 100644
--- a/django/core/management/utils.py
+++ b/django/core/management/utils.py
@@ -3,7 +3,7 @@ from subprocess import PIPE, Popen
from django.apps import apps as installed_apps
from django.utils.crypto import get_random_string
-from django.utils.encoding import DEFAULT_LOCALE_ENCODING, force_text
+from django.utils.encoding import DEFAULT_LOCALE_ENCODING
from .base import CommandError
@@ -20,8 +20,8 @@ def popen_wrapper(args, stdout_encoding='utf-8'):
raise CommandError('Error executing %s' % args[0]) from err
output, errors = p.communicate()
return (
- force_text(output, stdout_encoding, strings_only=True, errors='strict'),
- force_text(errors, DEFAULT_LOCALE_ENCODING, strings_only=True, errors='replace'),
+ output.decode(stdout_encoding),
+ errors.decode(DEFAULT_LOCALE_ENCODING, errors='replace'),
p.returncode
)