#28192: Prevent positional arguments on form fields
------------------------------------------------+------------------------
Reporter: Claude Paroz | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Forms | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
The documentation already indicates `(**kwargs)` for most of form field
signatures. But in practice, this isn't enforced and any positional
`*args` are passed to the `__init__` methods.
I encountered a strange error with some code of mine which was due to some
label passed erroneously as positional parameter:
`distance = DecimalField("SomeLabel", max_digits=6, decimal_places=2)`
("SomeLabel" was passed as max_value, which only crashed when validating
the form with a strange comparison error).
I think that preventing positional parameters (with a lonely `*`) should
avoid this sort of unexpected errors. This might however be backwards
incompatible for previously well-functioning code.
--
Ticket URL: <https://code.djangoproject.com/ticket/28192>
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/050.67bf1d13f7b2ceecee7f9d494c59cf37%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.