1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #25483 -- Allowed passing non-string arguments to call_command

Thanks KS Chan for the report and Tim Graham for the review.
This commit is contained in:
Claude Paroz
2015-10-03 09:58:36 +02:00
parent fa2e1e633a
commit 3f22e83e90
3 changed files with 13 additions and 1 deletions

View File

@@ -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', ())