Commit 39011ce0 by Piotr Mitros

Book module works

--HG--
branch : pmitros-mod-template
parent a50d3d7f
...@@ -92,7 +92,8 @@ def id_tag(course): ...@@ -92,7 +92,8 @@ def id_tag(course):
'html':'filename', 'html':'filename',
'vertical':'id', 'vertical':'id',
'tab':'id', 'tab':'id',
'schematic':'id'} 'schematic':'id',
'book' : 'id'}
# Tag elements with unique IDs # Tag elements with unique IDs
elements = course.xpath("|".join(['//'+c for c in default_ids])) elements = course.xpath("|".join(['//'+c for c in default_ids]))
...@@ -143,7 +144,7 @@ def course_file(user): ...@@ -143,7 +144,7 @@ def course_file(user):
filename = UserProfile.objects.get(user=user).courseware filename = UserProfile.objects.get(user=user).courseware
data_template = template_lookup.get_template(filename) data_template = template_lookup.get_template(filename)
options = {'dev_content':True} options = {'dev_content':settings.DEV_CONTENT}
tree = etree.XML(data_template.render(**options)) tree = etree.XML(data_template.render(**options))
id_tag(tree) id_tag(tree)
......
...@@ -41,6 +41,7 @@ class Command(BaseCommand): ...@@ -41,6 +41,7 @@ class Command(BaseCommand):
if os.path.exists(sections_dir): if os.path.exists(sections_dir):
print "Checking all section includes are valid XML" print "Checking all section includes are valid XML"
for f in os.listdir(sections_dir): for f in os.listdir(sections_dir):
print f
etree.parse(sections_dir+'/'+f) etree.parse(sections_dir+'/'+f)
else: else:
print "Skipping check of include files -- no section includes dir ("+sections_dir+")" print "Skipping check of include files -- no section includes dir ("+sections_dir+")"
......
...@@ -30,6 +30,7 @@ import courseware.modules.capa_module ...@@ -30,6 +30,7 @@ import courseware.modules.capa_module
import courseware.modules.html_module import courseware.modules.html_module
import courseware.modules.schematic_module import courseware.modules.schematic_module
import courseware.modules.seq_module import courseware.modules.seq_module
import courseware.modules.template_module
import courseware.modules.vertical_module import courseware.modules.vertical_module
import courseware.modules.video_module import courseware.modules.video_module
...@@ -44,6 +45,9 @@ modx_modules={'problem':courseware.modules.capa_module.LoncapaModule, ...@@ -44,6 +45,9 @@ modx_modules={'problem':courseware.modules.capa_module.LoncapaModule,
'tab':courseware.modules.seq_module.SequentialModule, 'tab':courseware.modules.seq_module.SequentialModule,
'schematic':courseware.modules.schematic_module.SchematicModule} 'schematic':courseware.modules.schematic_module.SchematicModule}
for f in os.listdir(settings.DATA_DIR+'/custom_tags'):
modx_modules[f] = courseware.modules.template_module.TemplateModule
def object_cache(cache, user, module_type, module_id): def object_cache(cache, user, module_type, module_id):
# We don't look up on user -- all queries include user # We don't look up on user -- all queries include user
# Additional lookup would require a DB hit the way Django # Additional lookup would require a DB hit the way Django
......
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