Commit bacd728e by Calen Pennington

Squelch some (but not all, yet) errors during template loading

parent f970da6d
...@@ -66,7 +66,7 @@ class ABTestModule(XModule): ...@@ -66,7 +66,7 @@ class ABTestModule(XModule):
class ABTestDescriptor(RawDescriptor, XmlDescriptor): class ABTestDescriptor(RawDescriptor, XmlDescriptor):
module_class = ABTestModule module_class = ABTestModule
# template_dir_name = "abtest" template_dir_name = "abtest"
def __init__(self, system, definition=None, **kwargs): def __init__(self, system, definition=None, **kwargs):
""" """
......
...@@ -38,6 +38,7 @@ class CustomTagModule(XModule): ...@@ -38,6 +38,7 @@ class CustomTagModule(XModule):
class CustomTagDescriptor(RawDescriptor): class CustomTagDescriptor(RawDescriptor):
""" Descriptor for custom tags. Loads the template when created.""" """ Descriptor for custom tags. Loads the template when created."""
module_class = CustomTagModule module_class = CustomTagModule
template_dir_name = 'customtag'
@staticmethod @staticmethod
def render_template(system, xml_data): def render_template(system, xml_data):
......
...@@ -31,8 +31,6 @@ def all_templates(): ...@@ -31,8 +31,6 @@ def all_templates():
templates = defaultdict(list) templates = defaultdict(list)
for category, descriptor in XModuleDescriptor.load_classes(): for category, descriptor in XModuleDescriptor.load_classes():
if category == 'course':
logging.debug(descriptor.templates())
templates[category] = descriptor.templates() templates[category] = descriptor.templates()
return templates return templates
...@@ -67,7 +65,13 @@ def update_templates(): ...@@ -67,7 +65,13 @@ def update_templates():
template_location = Location('i4x', 'edx', 'templates', category, Location.clean_for_url_name(template.metadata['display_name'])) template_location = Location('i4x', 'edx', 'templates', category, Location.clean_for_url_name(template.metadata['display_name']))
try: try:
json_data = {'definition': {'data': template.data, 'children' : template.children}} json_data = {
'definition': {
'data': template.data,
'children': template.children
},
'metadata': template.metadata
}
json_data['location'] = template_location.dict() json_data['location'] = template_location.dict()
XModuleDescriptor.load_from_json(json_data, TemplateTestSystem()) XModuleDescriptor.load_from_json(json_data, TemplateTestSystem())
......
--- ---
metadata: metadata:
display_name: Empty display_name: Empty
start: 2020-10-10T10:00
data: { 'textbooks' : [ ], 'wiki_slug' : null } data: { 'textbooks' : [ ], 'wiki_slug' : null }
children: [] children: []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment