Switch template definitions to yaml, so that they can have multiline strings
This commit is contained in:
@@ -644,6 +644,8 @@ class CapaDescriptor(RawDescriptor):
|
||||
# actually use type and points?
|
||||
metadata_attributes = RawDescriptor.metadata_attributes + ('type', 'points')
|
||||
|
||||
template_dir_name = 'problem'
|
||||
|
||||
# VS[compat]
|
||||
# TODO (cpennington): Delete this method once all fall 2012 course are being
|
||||
# edited in the cms
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"metadata": { "display_name": "Empty" },
|
||||
"data": "",
|
||||
"children": []
|
||||
}
|
||||
5
common/lib/xmodule/xmodule/templates/default/empty.yaml
Normal file
5
common/lib/xmodule/xmodule/templates/default/empty.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
metadata:
|
||||
display_name: Empty
|
||||
data: ""
|
||||
children: []
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
metadata:
|
||||
display_name: Multiline XML
|
||||
data: |
|
||||
<problem>
|
||||
</problem>
|
||||
children: []
|
||||
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
import pkg_resources
|
||||
import json
|
||||
import yaml
|
||||
import os
|
||||
|
||||
from functools import partial
|
||||
@@ -352,7 +352,7 @@ class ResourceTemplates(object):
|
||||
|
||||
for template_file in resource_listdir(__name__, dirname):
|
||||
template_content = resource_string(__name__, os.path.join(dirname, template_file))
|
||||
template = json.loads(template_content)
|
||||
template = yaml.load(template_content)
|
||||
templates.append(Template(**template))
|
||||
|
||||
return templates
|
||||
|
||||
Reference in New Issue
Block a user