Commit 1dd1d41d authored by Sebastien Robin's avatar Sebastien Robin

we must not check if an attribute has changed in validate, this is already the work done by edit


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2765 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f4704dcf
......@@ -917,7 +917,7 @@ class ListBoxWidget(Widget.Widget):
stat_context.absolute_url = lambda x: s[0].absolute_url()
stat_context.domain_url = s[0].getRelativeUrl()
section_title = s[0].getTitle()
section_title = translate('content', section_title, default=section_title.decode('utf-8'))
section_title = translate('content', section_title, section_title.decode('utf-8'))
section_title = section_title.encode('utf-8')
report_sections += [(s[0].getTitle(), 1, s[2], [stat_context], 1, s[3], s[4], stat_context, 0)]
# report id, is_summary, depth, object_list, object_list_len, XX, XX, report_object, start, stop
......@@ -1977,7 +1977,7 @@ class ListBoxValidator(Validator.Validator):
try:
value = my_field.validator.validate(my_field, key, REQUEST) # We need cell
result[uid[4:]][sql] = value
except ValidationError, err: # XXXX import missing
except ValidationError, err:
#LOG("ListBox ValidationError",0,str(err))
err.field_id = error_result_key
errors.append(err)
......@@ -2000,46 +2000,14 @@ class ListBoxValidator(Validator.Validator):
tales_expr = my_field.tales.get('default', "")
key = 'field_' + my_field.id + '_%s' % o.uid
error_result_key = my_field.id + '_%s' % o.uid
#if hasattr(o,cname_id): WHY THIS ????
# XXX This is not acceptable - we do not calculate things the same way in 2 different cases
REQUEST.cell = o # We need cell
try:
value = my_field.validator.validate(my_field, key, REQUEST) # We need cell
error_result[error_result_key] = value
if tales_expr:
# If the listbox displays a value generated by a field expression
# then compute it
real_o = o
field_kw = {'cell':real_o}
attribute_value = my_field.__of__(real_o).get_value('default',**field_kw)
else:
try:
attribute_value = o.getProperty(property_id)
except:
attribute_value = getattr(o,property_id, None)
if my_field.meta_type == "MultiListField":
test_equal = 1
# Sometimes, the attribute is not a list
# so we need to force update
try:
for v in attribute_value:
if v not in value:
test_equal = 0
except:
test_equal = 0
try:
for v in value:
if v not in attribute_value:
test_equal = 0
except:
test_equal = 0
else:
test_equal = attribute_value == value
if not result.has_key(o.getUrl()):
result[o.getUrl()] = {} # We always provide an empty dict - this should be improved by migrating the test of equality to Bae - it is not the purpose of ListBox to do this probably. XXX
if not test_equal:
result[o.getUrl()][sql] = value
except ValidationError, err: # XXXX import missing
result[o.getUrl()] = {}
result[o.getUrl()][sql] = value
except ValidationError, err:
#LOG("ListBox ValidationError",0,str(err))
err.field_id = error_result_key
errors.append(err)
......
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