Allow Media objects to have their own MEDIA_TYPES
|Reported by:||Keryn Knight <django@…>||Owned by:||Osmose|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
Currently, instances of Media look to the module scope to get the known MEDIA_TYPES. This makes it difficult to subclass Media to add extra render_x/add_x methods because MEDIA_TYPES is hardcoded in __init__, render, __getitem__ and __add__ and isn't easily available for a subclass to add to without monkeypatching the module constant. As far as I can tell, the only use of MEDIA_TYPES is in the widgets module, and could be shifted to the class itself, leaving the module level one to raise a deprecation warning.
Rationale is that I want to be able to add inline_css and inline_js, or text (for JS templates etc) to a Media object, and currently that's more difficult than just adjusting a subclass' attribute and adding the appropriate methods.
Change History (6)
comment:1 Changed 12 months ago by aaugustin
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:3 Changed 11 months ago by Osmose
- Has patch set
- Owner changed from nobody to Osmose
- Status changed from new to assigned