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

like 12287, but only use '%f' is '%s' uses exponential format



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12473 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3c866e00
......@@ -1006,16 +1006,18 @@ class FloatWidget(TextWidget):
if value not in (None,''):
input_style = field.get_value('input_style')
percent = 0
original_value = value
if input_style.find('%')>=0:
percent=1
value = float(value) * 100
try :
value = '%f' % (float(value))
value = str(float(value))
except ValueError:
return value
else:
if 'e' in value: # scientific notation hack
return value
if 'e' in value:
# %f will not use exponential format
return '%f' % float(original_value)
value_list = value.split('.')
integer = value_list[0]
if input_style.find(' ')>=0:
......
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