From 98d8f4b55bb6ca17e0545ce262213f15cff0f2bf Mon Sep 17 00:00:00 2001 From: Piotr Mitros Date: Thu, 31 May 2012 21:12:08 -0400 Subject: [PATCH] Unstable commit; syncing computers --- djangoapps/courseware/module_render.py | 6 +++--- djangoapps/courseware/modules/capa_module.py | 2 +- djangoapps/courseware/modules/html_module.py | 2 +- djangoapps/courseware/modules/schematic_module.py | 2 +- djangoapps/courseware/modules/seq_module.py | 4 ++-- djangoapps/courseware/modules/template_module.py | 2 +- djangoapps/courseware/modules/vertical_module.py | 2 +- djangoapps/courseware/modules/video_module.py | 2 +- djangoapps/courseware/modules/x_module.py | 4 +++- 9 files changed, 14 insertions(+), 12 deletions(-) diff --git a/djangoapps/courseware/module_render.py b/djangoapps/courseware/module_render.py index 1e12e182cd..e9303bb18b 100644 --- a/djangoapps/courseware/module_render.py +++ b/djangoapps/courseware/module_render.py @@ -128,14 +128,14 @@ def get_module(user, request, xml_module, module_object_preload): smod.save() module_object_preload.append(smod) - return smod + return (instance, smod) def render_x_module(user, request, xml_module, module_object_preload): ''' Generic module for extensions. This renders to HTML. ''' - if module==None : + if xml_module==None : return {"content":""} - smod = get_module(user, request, xml_module, module_object_preload) + (instance, smod) = get_module(user, request, xml_module, module_object_preload) # Grab content content = instance.get_html() diff --git a/djangoapps/courseware/modules/capa_module.py b/djangoapps/courseware/modules/capa_module.py index 3c357ee47e..9e2a62aca0 100644 --- a/djangoapps/courseware/modules/capa_module.py +++ b/djangoapps/courseware/modules/capa_module.py @@ -18,7 +18,7 @@ from lxml import etree ## TODO: Abstract out from Django from mitxmako.shortcuts import render_to_string -from x_module import XModule +from x_module import XModule, XModuleDescriptor from courseware.capa.capa_problem import LoncapaProblem, StudentInputError import courseware.content_parser as content_parser from multicourse import multicourse_settings diff --git a/djangoapps/courseware/modules/html_module.py b/djangoapps/courseware/modules/html_module.py index 3b62df0390..bf60174e18 100644 --- a/djangoapps/courseware/modules/html_module.py +++ b/djangoapps/courseware/modules/html_module.py @@ -2,7 +2,7 @@ import json from mitxmako.shortcuts import render_to_response, render_to_string -from x_module import XModule +from x_module import XModule, XModuleDescriptor from lxml import etree class ModuleDescriptor(XModuleDescriptor): diff --git a/djangoapps/courseware/modules/schematic_module.py b/djangoapps/courseware/modules/schematic_module.py index 1643737e4a..a6459b5e6e 100644 --- a/djangoapps/courseware/modules/schematic_module.py +++ b/djangoapps/courseware/modules/schematic_module.py @@ -4,7 +4,7 @@ import json from django.conf import settings from mitxmako.shortcuts import render_to_response, render_to_string -from x_module import XModule +from x_module import XModule, XModuleDescriptor class ModuleDescriptor(XModuleDescriptor): pass diff --git a/djangoapps/courseware/modules/seq_module.py b/djangoapps/courseware/modules/seq_module.py index 648582a166..f8ab6b9166 100644 --- a/djangoapps/courseware/modules/seq_module.py +++ b/djangoapps/courseware/modules/seq_module.py @@ -4,7 +4,7 @@ from lxml import etree from mitxmako.shortcuts import render_to_string -from x_module import XModule +from x_module import XModule, XModuleDescriptor # HACK: This shouldn't be hard-coded to two types # OBSOLETE: This obsoletes 'type' @@ -57,7 +57,7 @@ class Module(XModule): titles = ["\n".join([i.get("name").strip() for i in e.iter() if i.get("name") != None]) \ for e in self.xmltree] - self.contents = self.rendered_children(self) + self.contents = self.rendered_children() for contents, title in zip(self.contents, titles): contents['title'] = title diff --git a/djangoapps/courseware/modules/template_module.py b/djangoapps/courseware/modules/template_module.py index c779691cc1..938b5c4497 100644 --- a/djangoapps/courseware/modules/template_module.py +++ b/djangoapps/courseware/modules/template_module.py @@ -3,7 +3,7 @@ import os from mitxmako.shortcuts import render_to_response, render_to_string -from x_module import XModule +from x_module import XModule, XModuleDescriptor from lxml import etree class ModuleDescriptor(XModuleDescriptor): diff --git a/djangoapps/courseware/modules/vertical_module.py b/djangoapps/courseware/modules/vertical_module.py index 5f208bb796..0819fb9f1b 100644 --- a/djangoapps/courseware/modules/vertical_module.py +++ b/djangoapps/courseware/modules/vertical_module.py @@ -2,7 +2,7 @@ import json from mitxmako.shortcuts import render_to_response, render_to_string -from x_module import XModule +from x_module import XModule, XModuleDescriptor from lxml import etree class ModuleDescriptor(XModuleDescriptor): diff --git a/djangoapps/courseware/modules/video_module.py b/djangoapps/courseware/modules/video_module.py index 0f80a79e41..95c7102fed 100644 --- a/djangoapps/courseware/modules/video_module.py +++ b/djangoapps/courseware/modules/video_module.py @@ -5,7 +5,7 @@ from lxml import etree from mitxmako.shortcuts import render_to_response, render_to_string -from x_module import XModule +from x_module import XModule, XModuleDescriptor log = logging.getLogger("mitx.courseware.modules") diff --git a/djangoapps/courseware/modules/x_module.py b/djangoapps/courseware/modules/x_module.py index e77f4e36f6..93489fab04 100644 --- a/djangoapps/courseware/modules/x_module.py +++ b/djangoapps/courseware/modules/x_module.py @@ -1,3 +1,5 @@ +from lxml import etree + import courseware.progress def dummy_track(event_type, event): @@ -36,7 +38,7 @@ class XModule(object): Render all children. This really ought to return a list of xmodules, instead of dictionaries ''' - children = [render_function(e) for e in self.__xmltree] + children = [self.render_function(e) for e in self.__xmltree] return children def __init__(self, system = None, xml = None, item_id = None,