From 3f22e83e90bc2eeea5f65858660385a34fbf5486 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 3 Oct 2015 09:58:36 +0200 Subject: Fixed #25483 -- Allowed passing non-string arguments to call_command Thanks KS Chan for the report and Tim Graham for the review. --- django/core/management/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'django') diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 7e4982f0a2..eb49cce375 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -16,6 +16,7 @@ from django.core.management.base import ( from django.core.management.color import color_style from django.utils import autoreload, lru_cache, six from django.utils._os import npath, upath +from django.utils.encoding import force_text def find_commands(management_dir): @@ -106,7 +107,7 @@ def call_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=args) + defaults = parser.parse_args(args=[force_text(a) for a in args]) defaults = dict(defaults._get_kwargs(), **arg_options) # Move positional args out of options to mimic legacy optparse args = defaults.pop('args', ()) -- cgit v1.3