* when things don't load normally, use this * separate raw editing functionality into EditingDescriptor * raw descriptor just enforces that xml is valid * add a MalformedDescriptor that just saves a string * Fallback to it on import.
25 lines
735 B
Python
25 lines
735 B
Python
from pkg_resources import resource_string
|
|
from lxml import etree
|
|
from xmodule.mako_module import MakoModuleDescriptor
|
|
import logging
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
class EditingDescriptor(MakoModuleDescriptor):
|
|
"""
|
|
Module that provides a raw editing view of its data and children. It does not
|
|
perform any validation on its definition---just passes it along to the browser.
|
|
|
|
This class is intended to be used as a mixin.
|
|
"""
|
|
mako_template = "widgets/raw-edit.html"
|
|
|
|
js = {'coffee': [resource_string(__name__, 'js/src/raw/edit.coffee')]}
|
|
js_module_name = "RawDescriptor"
|
|
|
|
def get_context(self):
|
|
return {
|
|
'module': self,
|
|
'data': self.definition['data'],
|
|
}
|