Skip to content

Commit

Permalink
Merge pull request #117 from open-craft/fix-mako-context-modification
Browse files Browse the repository at this point in the history
Fix mako template context error
  • Loading branch information
bradenmacdonald authored Jul 13, 2016
2 parents fe0e825 + ee9d153 commit 7467e27
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ install:
- "pip install -r requirements.txt"
- "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/base.txt"
- "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/test.txt"
- "pip uninstall -y xblock-problem-builder && python setup.py sdist && pip install dist/xblock-problem-builder-2.0.3.tar.gz"
- "pip uninstall -y xblock-problem-builder && python setup.py sdist && pip install dist/xblock-problem-builder-2.0.4.tar.gz"
- "pip install -r test_requirements.txt"
- "mkdir var"
script:
Expand Down
4 changes: 2 additions & 2 deletions problem_builder/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def student_input(self):

def mentoring_view(self, context=None):
""" Render this XBlock within a mentoring block. """
context = context or {}
context = context.copy() if context else {}
context['self'] = self
context['hide_header'] = context.get('hide_header', False) or not self.show_title
html = loader.render_template('templates/html/answer_editable.html', context)
Expand Down Expand Up @@ -266,7 +266,7 @@ def student_input(self):

def mentoring_view(self, context=None):
""" Render this XBlock within a mentoring block. """
context = context or {}
context = context.copy() if context else {}
context['title'] = self.display_name
context['description'] = self.description
context['student_input'] = self.student_input
Expand Down
4 changes: 2 additions & 2 deletions problem_builder/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ def display_name_with_default(self):
return self._(u"Question")

def author_view(self, context):
context = context or {}
context = context.copy() if context else {}
context['hide_header'] = True
return self.mentoring_view(context)

def author_preview_view(self, context):
context = context or {}
context = context.copy() if context else {}
context['hide_header'] = True
return self.student_view(context)

Expand Down
4 changes: 2 additions & 2 deletions problem_builder/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class MentoringTableBlock(StudioEditableXBlockMixin, StudioContainerXBlockMixin,
has_children = True

def student_view(self, context):
context = context or {}
context = context.copy() if context else {}
fragment = Fragment()
header_values = []
content_values = []
Expand Down Expand Up @@ -136,7 +136,7 @@ class MentoringTableColumn(StudioEditableXBlockMixin, StudioContainerXBlockMixin

def mentoring_view(self, context=None):
""" Render this XBlock within a mentoring block. """
context = context or {}
context = context.copy() if context else {}
fragment = Fragment()
for child_id in self.children:
child = self.runtime.get_block(child_id)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def package_data(pkg, root_list):

setup(
name='xblock-problem-builder',
version='2.0.3',
version='2.0.4',
description='XBlock - Problem Builder',
packages=['problem_builder', 'problem_builder.v1'],
install_requires=[
Expand Down

0 comments on commit 7467e27

Please sign in to comment.