Commit 7943ac16 authored by Julien Muchembled's avatar Julien Muchembled

Do not keep entered values for editable listbox cells without uid

Without this, every rendered cells would contain the concatenation of all cells
with same uid (i.e. None) in the previous page, and the size of each cell would
increase exponentially at each update.
parent 0ca19b85
...@@ -2445,17 +2445,22 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine): ...@@ -2445,17 +2445,22 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
pass pass
if editable_field is not None: if editable_field is not None:
# XXX what if the object does not have uid? uid = self.getUid()
key = '%s_%s' % (editable_field.getId(), self.getUid()) key = '%s_%s' % (editable_field.getId(), uid)
if sql in editable_column_id_set: if sql in editable_column_id_set:
listbox_defines_column_as_editable = True listbox_defines_column_as_editable = True
# Like any other field in ERP5, always use the value entered by the if uid is None:
# user if any. This duplicates some work done by field.render
try:
display_value = editable_field._get_user_input_value(
editable_field.generate_field_key(key=key), request)
except (KeyError, AttributeError):
display_value = original_value display_value = original_value
else:
# Like any other field in ERP5, always use the value entered by the
# user if any. However, it's only possible if keys are unique,
# so this is skipped if there's no uid.
# This duplicates some work done by field.render
try:
display_value = editable_field._get_user_input_value(
editable_field.generate_field_key(key=key), request)
except (KeyError, AttributeError):
display_value = original_value
# If error on current field, we should display message # If error on current field, we should display message
if key in error_dict: if key in error_dict:
error_text = error_dict[key].error_text error_text = error_dict[key].error_text
......
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