#35459: Case.extra is undocumented, untested, and can hide potential issues
-------------------------------------+-------------------------------------
Reporter: Baptiste Mispelon | Owner: Priyank
Type: | Panchal
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls):
I think this ticket was accepted to add test coverage and improve the
documentation. `**extra` is documented in `Func`, but in `Case` the ticket
author reports the documentation being unclear, and in `Subquery` it's not
documented at all, so those two need doc edits and tests.
> The documentation [1] does mention that the signature is `class
Case(*cases, **extra)`, but doesn't explain what happens to **extra, and
even later refers to "the default keyword argument" which seems
inconsistent.
The key/value pairs get interpolated into the SQL template, which by
default includes the template param `default` (hence why the doc'd example
provides `default`), but the SQL template is a class variable and could
have arbitrary params if subclassed. This could be clarified.
--
Ticket URL: <https://code.djangoproject.com/ticket/35459#comment:7>
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/010701911971b7e6-1c2378aa-a9c4-4b03-b116-e8073f567681-000000%40eu-central-1.amazonses.com.