Commit b4227bb9 authored by Jérome Perrin's avatar Jérome Perrin

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 63dcec59
Pipeline #34657 failed with stage
in 0 seconds
...@@ -172,11 +172,11 @@ def editMatrixBox(matrixbox_field, matrixbox): ...@@ -172,11 +172,11 @@ def editMatrixBox(matrixbox_field, matrixbox):
for cell_index_tuple, cell_value_dict in matrixbox.items(): for cell_index_tuple, cell_value_dict in matrixbox.items():
# Only update cells which still exist # Only update cells which still exist
if not matrix_context.hasInRange(*cell_index_tuple, **kd): 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) cell = matrix_context.newCell(*cell_index_tuple, **kd)
if cell is None: 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 cell.edit(edit_order=edit_order, **gv) # First update globals which include the def. of property_list
if 'variated_property' in cell_value_dict: if 'variated_property' in cell_value_dict:
......
...@@ -184,9 +184,9 @@ def editMatrixBox(matrixbox_field, matrixbox): ...@@ -184,9 +184,9 @@ def editMatrixBox(matrixbox_field, matrixbox):
cleaned_v[key] = None cleaned_v[key] = None
cell.edit(edit_order=edit_order, **cleaned_v) # and update the cell specific values cell.edit(edit_order=edit_order, **cleaned_v) # and update the cell specific values
else: else:
return "Could not create cell %s" % str(cell_index_tuple) raise ValueError("Could not create cell %s" % str(cell_index_tuple))
else: 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) 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