#30584: call_command raises ValueError when subparser dest is passed in options.
-------------------------------------+-------------------------------------
     Reporter:  bill parquet         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * cc: Hasan Ramezani (added)
 * stage:  Unreviewed => Accepted
 * version:  2.2 => master


Comment:

 Thanks for the report.

 In Django 1.11 your custom command raises `TypeError: __init__() missing 1
 required positional argument: 'cmd'` which has been fixed in
 dd68b51e1da54267bde4799fa0d9fbd4290eb8b5. I wasn't able to run your
 example in Django < 2.2.

 `call_command('mycommand', 'foo', bar=True)` raises `TypeError: Unknown
 option(s) for mycommand command: bar.` which seems fine for me because you
 added only `--bar` argument, i.e.
 {{{
 >>> management.call_command('mycommand', 'foo', '--bar', '1')
 >>> management.call_command('mycommand', 'foo', '--bar', True)
 }}}
 work as expected.

 IMO there is only issue with validation of `call_command('mycommand',
 subcommand='foo', bar=True)` because it raises
 {{{
 File "django/core/management/__init__.py", line 130, in <listcomp>
     for opt in parser._actions if opt.required and opt.dest in options
 ValueError: min() arg is an empty sequence
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30584#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.ec4fdc5ab00053fc65063f7a5318ae9e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to