Commit 0875f5bc by Jonathan Piacenti

Polished up callable support so it works properly.

parent a9182da4
...@@ -126,7 +126,9 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin): ...@@ -126,7 +126,9 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
Load light children from the `xml_content` attribute Load light children from the `xml_content` attribute
""" """
self.light_children = [] self.light_children = []
if not hasattr(self, 'xml_content') or not self.xml_content: no_content = (not hasattr(self, 'xml_content') or not self.xml_content
or callable(self.xml_content))
if no_content:
return return
parser = etree.XMLParser(remove_comments=True) parser = etree.XMLParser(remove_comments=True)
......
...@@ -49,7 +49,8 @@ log = logging.getLogger(__name__) ...@@ -49,7 +49,8 @@ log = logging.getLogger(__name__)
def default_xml_content(): def default_xml_content():
return render_template('templates/xml/mentoring_default.xml', { return render_template('templates/xml/mentoring_default.xml', {
'url_name': 'mentoring-{}'.format(uuid.uuid4())}) 'url_name': 'mentoring-{}'.format(uuid.uuid4())})
# Classes ########################################################### # Classes ###########################################################
...@@ -99,6 +100,8 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin): ...@@ -99,6 +100,8 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin):
FLOATING_BLOCKS = (TitleBlock, MentoringMessageBlock, SharedHeaderBlock) FLOATING_BLOCKS = (TitleBlock, MentoringMessageBlock, SharedHeaderBlock)
FIELDS_TO_INIT = ('xml_content',)
@property @property
def is_assessment(self): def is_assessment(self):
return self.mode == 'assessment' return self.mode == 'assessment'
......
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