Changes between Initial Version and Version 1 of Ticket #26597
- Timestamp:
- May 8, 2016, 2:14:47 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #26597 – Description
initial v1 1 The 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 1 3 Because of the way options are parsed on: 2 4 https://github.com/django/django/blob/1.8.13/django/core/management/__init__.py#L106-L108 3 5 4 You can end up with the dictionary returning `.item ` back in one of two orders when you pass both `interactive` and `noinput`.6 You 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. 5 7 6 8 I assume this is present on other management commands, but I have not tested them. 7 9 10 (note, I simplified `opt_mapping` to just the example) 8 11 The following command: 9 12 `arg_options = {opt_mapping.get(key, key): value for key, value in options.items()}` … … 14 17 15 18 leading 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.