Code

Opened 5 years ago

Closed 5 years ago

#10128 closed (invalid)

widgets Media class has an initialisation error (maybe)

Reported by: peter2108 Owned by: nobody
Component: Forms Version: 1.0
Severity: Keywords: Media widget initialise
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The django.forms.widgets Media instance can be initialised in two ways, either by supplying a dictionary of media arguments or by supplying an existing Media instance via the 'media' keyword. Django does not AFAICT use this second method at all. Anyway it does not work. The offending code:

if media:
    media_attrs = media.__dict__
else:
    media_attrs = kwargs 

media.__dict__ gives a dictionary keyed by '_css' and '_js' whereas the subsequent code looks for 'css' and 'js' keys. Of course the (non-)role of the media keyword might be something else altogether in which case close the bug. Otherwise one could have media_attrs = {'css':media._css, 'js':media._js} at line two or even change the attributes _css and _js to be the same as the MEDIA_TYPES.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by peter2108

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Sorry this was my mistake.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.