mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #10080 -- Slightly extended the fix made in r10401 by also taking command line options into account that don't have have a default set. Thanks, Claude Paroz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17467 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -139,9 +139,12 @@ def call_command(name, *args, **options):
|
||||
# when the script runs from the command line, but since call_command can
|
||||
# be called programatically, we need to simulate the loading and handling
|
||||
# of defaults (see #10080 for details).
|
||||
defaults = dict([(o.dest, o.default)
|
||||
for o in klass.option_list
|
||||
if o.default is not NO_DEFAULT])
|
||||
defaults = {}
|
||||
for opt in klass.option_list:
|
||||
if opt.default is NO_DEFAULT:
|
||||
defaults[opt.dest] = None
|
||||
else:
|
||||
defaults[opt.dest] = opt.default
|
||||
defaults.update(options)
|
||||
|
||||
return klass.execute(*args, **defaults)
|
||||
|
||||
Reference in New Issue
Block a user