Commit a73588ae authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make sure that all objects but numbers are converted to unicode strings, in particular exceptions.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5287 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 01f94e03
...@@ -1086,7 +1086,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -1086,7 +1086,7 @@ class ListBoxWidget(Widget.Widget):
# Reset original value # Reset original value
selection.edit(report = None) selection.edit(report = None)
else: else:
#LOG('ListBox 612', 0, str((selection_name, selection.__dict__))) #LOG('ListBox 1054', 0, str((selection_name, selection.__dict__, selection)))
if list_method is not None: if list_method is not None:
if count_method is not None and not selection.invert_mode and render_format == 'html': if count_method is not None and not selection.invert_mode and render_format == 'html':
#LOG('ListBox', 0, 'use count_method %r' % count_method) #LOG('ListBox', 0, 'use count_method %r' % count_method)
...@@ -1765,14 +1765,12 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1765,14 +1765,12 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
td_align = "right" td_align = "right"
else: else:
td_align = "left" td_align = "left"
# It is safer to convert attribute_value to an unicode string, because if attribute_value is None:
# it might be utf-8.
if type(attribute_value) == type(''):
attribute_value = unicode(attribute_value, 'utf-8')
attribute_original_value = attribute_value
elif attribute_value is None:
attribute_original_value = None attribute_original_value = None
attribute_value = '' attribute_value = ''
elif type(attribute_value) != type(u''):
attribute_value = unicode(str(attribute_value), 'utf-8')
attribute_original_value = attribute_value
if sql in editable_column_ids and form.has_field('%s_%s' % (field.id, alias)) and not is_summary: if sql in editable_column_ids and form.has_field('%s_%s' % (field.id, alias)) and not is_summary:
key = my_field.id + '_%s' % o.uid key = my_field.id + '_%s' % o.uid
if field_errors.has_key(key): if field_errors.has_key(key):
...@@ -1867,7 +1865,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1867,7 +1865,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
# XXX FIXME: except without Error name # XXX FIXME: except without Error name
pass pass
# Generate appropriate HTML # Generate appropriate HTML
if type(attribute_value) in [type(''), type(u'')]: if type(attribute_value) == type(u''):
attribute_value = cgi.escape(attribute_value) attribute_value = cgi.escape(attribute_value)
if object_url is None: if object_url is None:
list_body_append( list_body_append(
......
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