[Django] #36104: forms.Media shouldn't expect media objects only

5 views
Skip to first unread message

Django

unread,
Jan 16, 2025, 8:40:58 AMJan 16
to django-...@googlegroups.com
#36104: forms.Media shouldn't expect media objects only
-------------------------------------+-------------------------------------
Reporter: Matthias | Owner: Matthias Kestenholz
Kestenholz |
Type: Bug | Status: assigned
Component: Forms | Version: 5.1
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.)
--
Ticket URL: <https://code.djangoproject.com/ticket/36104>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 16, 2025, 8:44:56 AMJan 16
to django-...@googlegroups.com
#36104: forms.Media shouldn't expect media objects only
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Matthias
| Kestenholz
Type: Bug | Status: assigned
Component: Forms | Version: 5.1
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 Matthias Kestenholz):

[https://github.com/django/django/pull/19058 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36104#comment:1>

Django

unread,
Jan 16, 2025, 2:31:49 PMJan 16
to django-...@googlegroups.com
#36104: forms.Media shouldn't expect media objects only
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Matthias
Type: | Kestenholz
Cleanup/optimization | Status: assigned
Component: Forms | Version: dev
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
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted
* type: Bug => Cleanup/optimization
* version: 5.1 => dev

Comment:

Accepting, this is somewhat similar to 35648.
--
Ticket URL: <https://code.djangoproject.com/ticket/36104#comment:2>

Django

unread,
Feb 14, 2025, 2:03:51 AMFeb 14
to django-...@googlegroups.com
#36104: forms.Media shouldn't expect media objects only
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Matthias
Type: | Kestenholz
Cleanup/optimization | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Raphael Gaschignard):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36104#comment:3>
Reply all
Reply to author
Forward
0 new messages