Commit 4b9a5a15 by Sven Marnach

Remove __init__() method of ActiveTableXBlock.

According to the docstring of the XBlock class, subclasses are not allowed to
override __init__().  (Seriously?)
parent dc4a23a9
...@@ -98,16 +98,6 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -98,16 +98,6 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
has_score = True has_score = True
def __init__(self, *args, **kwargs):
super(ActiveTableXBlock, self).__init__(*args, **kwargs)
self.thead = None
self.tbody = None
self._column_widths = None
self._row_heights = None
self.response_cells = None
self.parse_fields()
self.postprocess_table()
def parse_fields(self): def parse_fields(self):
"""Parse the user-provided fields into more processing-friendly structured data.""" """Parse the user-provided fields into more processing-friendly structured data."""
if self.table_definition: if self.table_definition:
...@@ -153,6 +143,9 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -153,6 +143,9 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
def student_view(self, context=None): def student_view(self, context=None):
"""Render the table.""" """Render the table."""
self.parse_fields()
self.postprocess_table()
context = dict( context = dict(
help_text=self.help_text, help_text=self.help_text,
total_width=sum(self._column_widths) if self._column_widths else None, total_width=sum(self._column_widths) if self._column_widths else None,
...@@ -187,6 +180,8 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -187,6 +180,8 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
This handler is called when the "Check" button is clicked. This handler is called when the "Check" button is clicked.
""" """
self.parse_fields()
self.postprocess_table()
correct = { correct = {
cell_id: self.response_cells[cell_id].check_response(value) cell_id: self.response_cells[cell_id].check_response(value)
for cell_id, value in data.iteritems() for cell_id, value in data.iteritems()
......
...@@ -7,8 +7,10 @@ max-line-length=100 ...@@ -7,8 +7,10 @@ max-line-length=100
[MESSAGES CONTROL] [MESSAGES CONTROL]
disable= disable=
I, I,
attribute-defined-outside-init,
too-few-public-methods, too-few-public-methods,
too-many-ancestors too-many-ancestors,
too-many-instance-attributes
[VARIABLES] [VARIABLES]
dummy-variables-rgx=_$|dummy|unused dummy-variables-rgx=_$|dummy|unused
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