learningequality / le-utils

Utilities and constants shared across Kolibri, Ricecooker, and Kolibri Studio
MIT License
2 stars 31 forks source link

Add convertible_formats to format_presets json list #51

Closed elaeon closed 5 years ago

elaeon commented 5 years ago

This is needed to support the two SRT-->VTT conversion PRs:

https://github.com/learningequality/pressurecooker/pull/21 and https://github.com/learningequality/ricecooker/pull/189

The new convertible_formats attribute added to the file formats lookup json made me a bit worried that this would cause an error on Studio: https://github.com/learningequality/studio/blob/develop/contentcuration/contentcuration/management/commands/loadconstants.py#L205-L206 but apparently no, Django models will let you set arbitrary fields on them that don't exist:

In [1]: from contentcuration.models import FileFormat
In [7]: ffobj = FileFormat.objects.all()[0]
In [8]: ffobj.__dict__
{'_state': <django.db.models.base.ModelState at 0x10dbb5dd0>,
 'extension': u'graphie',
 'mimetype': u'.graphie'}

In [9]: ffobj.anything_you_want = 'is possible with Django'       # < < NO ERROR

In [10]: ffobj.__dict__
{'_state': <django.db.models.base.ModelState at 0x10dbb5dd0>,
 'anything_you_want': 'is possible',
 'extension': u'graphie',
 'mimetype': u'.graphie'}