Commit 9218a3d6 authored by Julien Muchembled's avatar Julien Muchembled

ListBox: add 'listbox_selected=<bool>' to validated value

This helps writing workflow script because 'listbox' dict does not contain
uids, which makes global 'uids' request value unusable.
parent f36260d2
...@@ -2767,6 +2767,9 @@ class ListBoxValidator(Validator.Validator): ...@@ -2767,6 +2767,9 @@ class ListBoxValidator(Validator.Validator):
except KeyError: except KeyError:
raise KeyError('Field %s is not present in request object.' raise KeyError('Field %s is not present in request object.'
% field.id) % field.id)
select = field.get_value('select')
if select:
selected_uid_set = set(REQUEST.get('uids', ()))
#LOG('ListBox.validate: REQUEST',0,REQUEST) #LOG('ListBox.validate: REQUEST',0,REQUEST)
errors = [] errors = []
object_list = None object_list = None
...@@ -2894,6 +2897,8 @@ class ListBoxValidator(Validator.Validator): ...@@ -2894,6 +2897,8 @@ class ListBoxValidator(Validator.Validator):
else: else:
LOG("ListBox WARNING",0,"Object uid %s could not be validated" % uid) LOG("ListBox WARNING",0,"Object uid %s could not be validated" % uid)
result[row_key] = row_result result[row_key] = row_result
if select:
row_result['listbox_selected'] = uid in selected_uid_set
if len(errors) > 0: if len(errors) > 0:
#LOG("ListBox FormValidationError",0,str(error_result)) #LOG("ListBox FormValidationError",0,str(error_result))
#LOG("ListBox FormValidationError",0,str(errors)) #LOG("ListBox FormValidationError",0,str(errors))
......
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