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):
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):
"""Parse the user-provided fields into more processing-friendly structured data."""
if self.table_definition:
......@@ -153,6 +143,9 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
def student_view(self, context=None):
"""Render the table."""
self.parse_fields()
self.postprocess_table()
context = dict(
help_text=self.help_text,
total_width=sum(self._column_widths) if self._column_widths else None,
......@@ -187,6 +180,8 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
This handler is called when the "Check" button is clicked.
"""
self.parse_fields()
self.postprocess_table()
correct = {
cell_id: self.response_cells[cell_id].check_response(value)
for cell_id, value in data.iteritems()
......
......@@ -7,8 +7,10 @@ max-line-length=100
[MESSAGES CONTROL]
disable=
I,
attribute-defined-outside-init,
too-few-public-methods,
too-many-ancestors
too-many-ancestors,
too-many-instance-attributes
[VARIABLES]
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