Commit 1031cbb1 by dragonfi

Fix errors when context in None

parent 2444c16a
...@@ -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
......
...@@ -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