Commit b59e5e4f by Xavier Antoviaque

Merge pull request #85 from open-craft/dragonfi-workbench-workaround

Workaround for workbench not assigning location parameter
parents 3a7b7822 1031cbb1
...@@ -56,7 +56,8 @@ class HTMLBlock(LightChild): ...@@ -56,7 +56,8 @@ class HTMLBlock(LightChild):
return block return block
def student_view(self, context=None): def student_view(self, context=None):
if context.get('as_template', True): as_template = context.get('as_template', True) if context is not None else True
if as_template:
return Fragment(u"<script type='text/template' id='{}'>\n{}\n</script>".format( return Fragment(u"<script type='text/template' id='{}'>\n{}\n</script>".format(
'light-child-template', 'light-child-template',
self.content self.content
......
...@@ -216,7 +216,10 @@ class LightChild(Plugin, LightChildrenMixin): ...@@ -216,7 +216,10 @@ class LightChild(Plugin, LightChildrenMixin):
def __init__(self, parent): def __init__(self, parent):
self.parent = parent self.parent = parent
self.location = parent.location try:
self.location = parent.location
except AttributeError:
self.location = None
self.scope_ids = parent.scope_ids self.scope_ids = parent.scope_ids
self.xblock_container = parent.xblock_container self.xblock_container = parent.xblock_container
self._student_data_loaded = False self._student_data_loaded = False
......
...@@ -75,7 +75,7 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin): ...@@ -75,7 +75,7 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin):
def student_view(self, context=None): def student_view(self, context=None):
name = self.__class__.__name__ name = self.__class__.__name__
as_template = context.get('as_template', True) as_template = context.get('as_template', True) if context is not None else True
if str(self.type) not in self.valid_types: if str(self.type) not in self.valid_types:
raise ValueError(u'Invalid value for {}.type: `{}`'.format(name, self.type)) raise ValueError(u'Invalid value for {}.type: `{}`'.format(name, self.type))
......
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