From 992c172a1624a1eace5bd89c10af49718c031aca Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Thu, 18 Nov 2004 16:58:59 +0000 Subject: [PATCH] do not dispaly the .0 with integer fields git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1913 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Form/FormulatorPatch.py | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/product/ERP5Form/FormulatorPatch.py b/product/ERP5Form/FormulatorPatch.py index 775b2b1632..b69f0b8b61 100755 --- a/product/ERP5Form/FormulatorPatch.py +++ b/product/ERP5Form/FormulatorPatch.py @@ -247,6 +247,38 @@ class PatchedLinkWidget(TextWidget) : PatchedLinkWidgetInstance = PatchedLinkWidget() LinkField.widget = PatchedLinkWidgetInstance +class IntegerWidget(TextWidget) : + def render(self, field, key, value, REQUEST) : + """Render link. + """ + LOG('IntegerWidget.render, value',0,repr(value)) + LOG('IntegerWidget.render, type(value)',0,type(value)) + if type(value) is type(1.0): + value = int(value) + display_maxwidth = field.get_value('display_maxwidth') or 0 + if display_maxwidth > 0: + return render_element("input", + type="text", + name=key, + css_class=field.get_value('css_class'), + value=value, + size=field.get_value('display_width'), + maxlength=display_maxwidth, + extra=field.get_value('extra')) + else: + return render_element("input", + type="text", + name=key, + css_class=field.get_value('css_class'), + value=value, + size=field.get_value('display_width'), + extra=field.get_value('extra')) + + +from Products.Formulator.StandardFields import IntegerField +IntegerFieldWidgetInstance = IntegerWidget() +IntegerField.widget = IntegerFieldWidgetInstance + import string def StringBaseValidator_validate(self, field, key, REQUEST): -- 2.30.9