Changes between Initial Version and Version 1 of Ticket #26597


Ignore:
Timestamp:
May 8, 2016, 2:14:47 PM (9 years ago)
Author:
Joseph Kahn
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26597 – Description

    initial v1  
     1The option mapping for argparse in `call_command` is incorrectly mapping args. For example, it maps `noinput` to `interactive` and does not take into account that they are opposites. Here's where the bug is:
     2
    13Because of the way options are parsed on:
    24https://github.com/django/django/blob/1.8.13/django/core/management/__init__.py#L106-L108
    35
    4 You can end up with the dictionary returning `.item` back in one of two orders when you pass both `interactive` and `noinput`.
     6You can end up with the dictionary returning `.items` back in one of two orders when you pass both `interactive` and `noinput`. Which is what I was doing in a test case.
    57
    68I assume this is present on other management commands, but I have not tested them.
    79
     10(note, I simplified `opt_mapping` to just the example)
    811The following command:
    912`arg_options = {opt_mapping.get(key, key): value for key, value in options.items()}`
     
    1417
    1518leading to `interactive` being False or True, respectively.
    16 
    17 The weird thing, is that `noinput` and `interactive` are opposite commands and yet this code uses it for the same value. Makes my scripts sometimes fail.
Back to Top