Allow Media objects to have their own MEDIA_TYPES
|Reported by:||Owned by:||Michael Kelly|
|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
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
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:3 Changed 3 years ago by
|Owner:||changed from nobody to Michael Kelly|
|Status:||new → assigned|