#34723: `TypeError` when loading a Django app with incorrect type of `choices`
-------------------------------------+-------------------------------------
Reporter: Natalia Bidart | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* resolution: => wontfix
Comment:
> I believe that the code in `Field.get_choices` could be a little more
robust, so exceptions are not raised on incorrect choices type.
I'm not sure it's worth changing, it's clearly user error that's easy to
notice, understand, and fix. Furthermore, there are other places that
assume `choices` is iterable (e.g. `flatchoices`). Are we going to add
protection to all of them? You can find many such edge cases in Django
source code, when a type is assumed. IMO, we don't need to be
overprotective. Especially since this is already covered by a system
check.
> Ideally we'd let the check framework run and report these issues is a
friendlier manner.
Autoreloader cannot run checks after each change, this would have bad
impact on developers experience. We even added an option to not run checks
even once, check out #32296.
--
Ticket URL: <https://code.djangoproject.com/ticket/34723#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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018977126a73-cba45f12-25ea-4c1c-812d-03fdc9178d42-000000%40eu-central-1.amazonses.com.