Merge pull request #966 from MITx/feature/cale/cas-template-import-errors

Squelch some (but not all, yet) errors during template loading
This commit is contained in:
chrisndodge
2012-10-24 17:34:58 -07:00
4 changed files with 10 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ class ABTestModule(XModule):
class ABTestDescriptor(RawDescriptor, XmlDescriptor):
module_class = ABTestModule
# template_dir_name = "abtest"
template_dir_name = "abtest"
def __init__(self, system, definition=None, **kwargs):
"""

View File

@@ -38,6 +38,7 @@ class CustomTagModule(XModule):
class CustomTagDescriptor(RawDescriptor):
""" Descriptor for custom tags. Loads the template when created."""
module_class = CustomTagModule
template_dir_name = 'customtag'
@staticmethod
def render_template(system, xml_data):

View File

@@ -31,8 +31,6 @@ def all_templates():
templates = defaultdict(list)
for category, descriptor in XModuleDescriptor.load_classes():
if category == 'course':
logging.debug(descriptor.templates())
templates[category] = descriptor.templates()
return templates
@@ -67,7 +65,13 @@ def update_templates():
template_location = Location('i4x', 'edx', 'templates', category, Location.clean_for_url_name(template.metadata['display_name']))
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()
XModuleDescriptor.load_from_json(json_data, TemplateTestSystem())

View File

@@ -1,5 +1,6 @@
---
metadata:
display_name: Empty
start: 2020-10-10T10:00
data: { 'textbooks' : [ ], 'wiki_slug' : null }
children: []