#36104 closed Bug (fixed)
forms.Media shouldn't expect media objects only
| Reported by: | Matthias Kestenholz | Owned by: | Jacob Walls |
|---|---|---|---|
| Component: | Forms | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
While thinking about https://forum.djangoproject.com/t/rejuvenating-vs-deprecating-form-media/21285 I have noticed that the forms.Media.__add__ method assumes that media objects are only ever added to each other. That doesn't necessarily have to be the case.
I propose returning NotImplemented when the RHS isn't a Media instance but something else.
All tests pass locally.
(It has nothing to do with https://code.djangoproject.com/ticket/35648 specifically but the same discussion probably applies.)
Change History (9)
comment:1 by , 17 months ago
comment:2 by , 17 months ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | Bug → Cleanup/optimization |
| Version: | 5.1 → dev |
Accepting, this is somewhat similar in concept to #35648.
comment:3 by , 16 months ago
| Patch needs improvement: | set |
|---|
comment:4 by , 6 days ago
| Patch needs improvement: | unset |
|---|
This PR was ready for another review, but Trac wasn't updated.
comment:5 by , 5 days ago
| Patch needs improvement: | set |
|---|---|
| Type: | Cleanup/optimization → Bug |
The additional flexibility might be a cleanup, but not returning NotImplemented for arbitrary types is a bug IMO. Left minor questions on the PR.
comment:7 by , 5 days ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Clifford and Hasan approved on GitHub.
PR