[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/ Fix a
bug in TextAreaWidget. The method _toFieldValue didn't
convert the form request to unicode and we got not unicoded
strings back which didn't pass the validate() call in the
method getInputValue() . Because of this bug there was no way
to activate a utility in the utility registration. I think
there is still more work needed in the form/ widget part.
Roger Ineichen
roger at projekt01.ch
Fri May 28 17:07:55 EDT 2004
Log message for revision 25105:
Fix a bug in TextAreaWidget. The method _toFieldValue didn't convert the form request to unicode and we got not unicoded strings back which didn't pass the validate() call in the method getInputValue() . Because of this bug there was no way to activate a utility in the utility registration. I think there is still more work needed in the form/ widget part.
-=-
Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_textareawidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_textareawidget.py 2004-05-28 21:06:53 UTC (rev 25104)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_textareawidget.py 2004-05-28 21:07:54 UTC (rev 25105)
@@ -114,7 +114,9 @@
'field.s1' : 'foo' }) # not unicode
self.assertEqual(response.getStatus(), 200)
- self.assert_(validationErrorExists(
+ # XXX We don't have a invalid field value
+ # since we convert the value to unicode
+ self.assert_(not validationErrorExists(
's1', 'Object is of wrong type.', response.getBody()))
Modified: Zope3/trunk/src/zope/app/form/browser/textwidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/textwidgets.py 2004-05-28 21:06:53 UTC (rev 25104)
+++ Zope3/trunk/src/zope/app/form/browser/textwidgets.py 2004-05-28 21:07:54 UTC (rev 25105)
@@ -259,6 +259,12 @@
if value:
value = decode_html(value)
value = value.replace("\r\n", "\n")
+ # Converting the value to unicode.
+ try:
+ value = unicode(value)
+ except ValueError, v:
+ raise ConversionError("Invalid integer data", v)
+
return value
def _toFormValue(self, value):
More information about the Zope3-Checkins
mailing list