Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-activetable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
xblock-activetable
Commits
5d2bc7df
Commit
5d2bc7df
authored
Oct 26, 2015
by
Sven Marnach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate the number of entries in column widths and row heights.
parent
072ab3ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
activetable/activetable.py
+16
-3
No files found.
activetable/activetable.py
View file @
5d2bc7df
...
...
@@ -248,16 +248,29 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
"""Add a validation error."""
validation
.
add
(
ValidationMessage
(
ValidationMessage
.
ERROR
,
msg
))
try
:
parse_table
(
data
.
table_definition
)
thead
,
tbody
=
parse_table
(
data
.
table_definition
)
except
ParseError
as
exc
:
add_error
(
'Problem with table definition: '
+
exc
.
message
)
thead
=
tbody
=
None
if
data
.
column_widths
:
try
:
parse_number_list
(
data
.
column_widths
)
column_widths
=
parse_number_list
(
data
.
column_widths
)
except
ParseError
as
exc
:
add_error
(
'Problem with column widths: '
+
exc
.
message
)
else
:
if
thead
is
not
None
and
len
(
column_widths
)
!=
len
(
thead
):
add_error
(
'The number of list entries in the Column widths field must match the '
'number of columns in the table.'
)
if
data
.
row_heights
:
try
:
parse_number_list
(
data
.
row_heights
)
row_heights
=
parse_number_list
(
data
.
row_heights
)
except
ParseError
as
exc
:
add_error
(
'Problem with row heights: '
+
exc
.
message
)
else
:
if
tbody
is
not
None
and
len
(
row_heights
)
!=
len
(
tbody
)
+
1
:
add_error
(
'The number of list entries in the Row heights field must match the number '
'of rows in the table.'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment