#29133: call_command() fails if a required option is passed in via **options -------------------------------------+------------------------------------- Reporter: Alex Tomic | Owner: Alex Type: | Tomic Cleanup/optimization | Status: assigned Component: Core (Management | Version: 2.0 commands) | Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Alex Tomic): Replying to [comment:2 Tim Graham]: > I'm not sure if the additional code complexity is worth supporting this. I noted this recommendation from the Python documentation, "Required options are generally considered bad form because users expect options to be optional, and thus they should be avoided when possible." An alternative could be to document the limitation. Thanks for the quick feedback. I figured this would be a 1-2 line fix, but it turned out to be a bit more complex than I thought. I agree it's a bit unnecessary given that the python docs recommend against this practice. Ironically, I ran up against this as I was trying to wrap a few such unwieldy management commands doing exactly that. I don't believe it is universally agreed upon that -/-- parameters should always be optional, though, outside of the Python world. Getopt_long [ 1 ] and the Open Group utility conventions [ 2 ], for example, don't recommend against it as far as I can tell. All that said, if this patch seems too risky to fix such a minor issue, I'd also be happy to contribute a documentation change instead. [1] https://www.gnu.org/software/libc/manual/html_node/Getopt-Long- Options.html#Getopt-Long-Options [2] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html e.g. Section 12.1.9 -- Ticket URL: <https://code.djangoproject.com/ticket/29133#comment:3> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.3298c0c31f00adfe4a61ca2b5d2bfca0%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.