[Erp5-report] r19455 - /erp5/trunk/products/ERP5Form/FormulatorPatch.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 21 16:40:50 CET 2008


Author: kazuhiko
Date: Thu Feb 21 16:40:49 2008
New Revision: 19455

URL: http://svn.erp5.org?rev=19455&view=rev
Log:
If type definition is missing for LinesField, the input text will be
splitted into list like ['f', 'o', 'o'] with original Formulator's
implementation. So explicit conversion to list is required before
passing to LinesTextAreaWidget's render and render_view methods.

Modified:
    erp5/trunk/products/ERP5Form/FormulatorPatch.py

Modified: erp5/trunk/products/ERP5Form/FormulatorPatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/FormulatorPatch.py?rev=19455&r1=19454&r2=19455&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/FormulatorPatch.py (original)
+++ erp5/trunk/products/ERP5Form/FormulatorPatch.py Thu Feb 21 16:40:49 2008
@@ -1513,3 +1513,23 @@
     map(getSearchSource,
         (self.values.values()+self.tales.values()+self.overrides.values())))
 Field.PrincipiaSearchSource = Field_PrincipiaSearchSource
+
+# If type definition is missing for LinesField, the input text will be
+# splitted into list like ['f', 'o', 'o'] with original Formulator's
+# implementation. So explicit conversion to list is required before
+# passing to LinesTextAreaWidget's render and render_view methods.
+from Products.Formulator.Widget import LinesTextAreaWidget
+
+original_LinesTextAreaWidget_render = LinesTextAreaWidget.render
+def LinesTextAreaWidget_render(self, field, key, value, REQUEST):
+  if isinstance(value, (str, unicode)):
+    value = [value]
+  return original_LinesTextAreaWidget_render(self, field, key, value, REQUEST)
+LinesTextAreaWidget.render = LinesTextAreaWidget_render
+
+original_LinesTextAreaWidget_render_view = LinesTextAreaWidget.render_view
+def LinesTextAreaWidget_render_view(self, field, key, value, REQUEST):
+  if isinstance(value, (str, unicode)):
+    value = [value]
+  return original_LinesTextAreaWidget_render_view(self, field, key, value, REQUEST)
+LinesTextAreaWidget.render_view = LinesTextAreaWidget_render_view




More information about the Erp5-report mailing list