From 3e2315c80ab5651159329f3db87240f2f69cc81f Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Mon, 13 Jun 2005 19:02:49 +0000
Subject: [PATCH] Added FloatWidget formatting to render_view.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3248 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/FormulatorPatch.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Form/FormulatorPatch.py b/product/ERP5Form/FormulatorPatch.py
index b0f3ffbe12..f32c0384d9 100755
--- a/product/ERP5Form/FormulatorPatch.py
+++ b/product/ERP5Form/FormulatorPatch.py
@@ -757,9 +757,8 @@ class FloatWidget(TextWidget):
                                         default=None,
                                         required=0)
 
-    def render(self, field, key, value, REQUEST):
-        """Render Float input field
-        """
+    def format_value(self, field, value):
+        """Formats the value as requested"""
         if value not in (None,''):
           input_style = field.get_value('input_style')
           percent = 0
@@ -790,9 +789,20 @@ class FloatWidget(TextWidget):
             value += value_list[1]
           if percent:
             value += '%'
+        return value
 
+    def render(self, field, key, value, REQUEST):
+        """Render Float input field
+        """
+        value = self.format_value(field, value)
         return TextWidgetInstance.render(field, key, value, REQUEST)
 
+    def render_view(self, field, value):
+        """Render Float display field
+        """
+        value = self.format_value(field, value)
+        return TextWidgetInstance.render_view(field, value)
+
 FloatWidgetInstance = FloatWidget()
 from Products.Formulator.StandardFields import FloatField
 FloatField.widget = FloatWidgetInstance
-- 
2.30.9