#10080: call_command doesn't take into account command's default options
----------------------------+-----------------------------------------------
Reporter: alexkoshelev | Owner: alexkoshelev
Status: new | Milestone: post-1.0
Component: Core framework | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 1 |
----------------------------+-----------------------------------------------
When I want to use manage.py command from python I must specify all
options on which this command is depend.
Almost everyone custom command's author write `execute` method something
like this:
{{{
#!python
class Command(BaseCommand):
option_list = [make_option("--some_option", default="foobar")]
def execute(self, *args, **options):
#...
some_option = options["some_option"]
#...
}}}
And when I call it using `call_command` without `some_option` is specified
I get the `KeyError`. But it works fine in command line because `optparse`
provides default values.
{{{
#!python
>>> call_command("some_command")
Traceback (most recent call last):
...
KeyError: 'some_option'
}}}
Patch solves this inconsistence.
--
Ticket URL: <http://code.djangoproject.com/ticket/10080>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---