Commit c7f58b2c authored by Jérome Perrin's avatar Jérome Perrin Committed by Kazuhiko Shiozaki

core: make Base_edit raise in case of wrong matrixbox keys

This should not happens, but if this happens we should not just return
in the middle of the loop, because this returned value is not used,
so we would just silently edit partially.
parent e9cda485
......@@ -172,11 +172,11 @@ def editMatrixBox(matrixbox_field, matrixbox):
for cell_index_tuple, cell_value_dict in matrixbox.items():
# Only update cells which still exist
if not matrix_context.hasInRange(*cell_index_tuple, **kd):
return "Cell %s does not exist" % str(cell_index_tuple)
raise ValueError("Cell %s does not exist" % str(cell_index_tuple))
cell = matrix_context.newCell(*cell_index_tuple, **kd)
if cell is None:
return "Could not create cell %s" % str(cell_index_tuple)
raise ValueError("Could not create cell %s" % str(cell_index_tuple))
cell.edit(edit_order=edit_order, **gv) # First update globals which include the def. of property_list
if 'variated_property' in cell_value_dict:
......
......@@ -184,9 +184,9 @@ def editMatrixBox(matrixbox_field, matrixbox):
cleaned_v[key] = None
cell.edit(edit_order=edit_order, **cleaned_v) # and update the cell specific values
else:
return "Could not create cell %s" % str(cell_index_tuple)
raise ValueError("Could not create cell %s" % str(cell_index_tuple))
else:
return "Cell %s does not exist" % str(cell_index_tuple)
raise ValueError("Cell %s does not exist %s" % str(cell_index_tuple))
field_prefix_len = len(field_prefix)
......
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