Switch template definitions to yaml, so that they can have multiline strings

This commit is contained in:
Calen Pennington
2012-09-25 09:48:54 -04:00
parent 022e27e1a2
commit 5410e161f9
5 changed files with 16 additions and 7 deletions

View File

@@ -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

View File

@@ -1,5 +0,0 @@
{
"metadata": { "display_name": "Empty" },
"data": "",
"children": []
}

View File

@@ -0,0 +1,5 @@
---
metadata:
display_name: Empty
data: ""
children: []

View File

@@ -0,0 +1,7 @@
---
metadata:
display_name: Multiline XML
data: |
<problem>
</problem>
children: []

View File

@@ -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