[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/ Merged from trunk:
Jim Fulton
jim at zope.com
Thu Dec 23 16:24:36 EST 2004
Log message for revision 28695:
Merged from trunk:
r28694 | jim | 2004-12-23 16:11:12 -0500 (Thu, 23 Dec 2004) | 6 lines
Fixed bug:
- TextWidgets set the value attribute to "value" when the field
has a missing value set and was not required and when there
was no input.
Changed:
U Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt
U Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/tests/test_textwidget.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/textwidgets.py
-=-
Modified: Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt
===================================================================
--- Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt 2004-12-23 21:11:12 UTC (rev 28694)
+++ Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt 2004-12-23 21:24:35 UTC (rev 28695)
@@ -42,6 +42,13 @@
- Fixed issue 228.
+ - TextWidgets set the value attribute to "value" when the field
+ has a missing value set and was not required and when there
+ was no input.
+
+ - Fixed a bug in the adapter registry that would prevent `dict`-derived
+ utilites from being retrieved correctly.
+
- A service registration form now displays correct information
about the registration.
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/tests/test_textwidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/tests/test_textwidget.py 2004-12-23 21:11:12 UTC (rev 28694)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/tests/test_textwidget.py 2004-12-23 21:24:35 UTC (rev 28695)
@@ -116,6 +116,34 @@
self._widget.extra = 'style="color: red"'
self.verifyResult(self._widget.hidden(), check_list)
+def test_w_nonrequired_and_missing_value_and_no_inout():
+ """
+ There was a bug that caused the value attribute to be set to
+ 'value' under these circumstances.
+
+ >>> from zope.publisher.browser import TestRequest
+ >>> from zope.schema import TextLine
+ >>> field = TextLine(__name__='foo', title=u'on',
+ ... required=False, missing_value=u'')
+ >>> request = TestRequest()
+ >>> widget = TextWidget(field, request)
+
+ >>> def normalize(s):
+ ... return '\\n '.join(filter(None, s.split(' ')))
+
+ >>> print normalize( widget() )
+ <input
+ class="textType"
+ id="field.foo"
+ name="field.foo"
+ size="20"
+ type="text"
+ value=""
+ />
+
+
+ """
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(TextWidgetTest),
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/textwidgets.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/textwidgets.py 2004-12-23 21:11:12 UTC (rev 28694)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/textwidgets.py 2004-12-23 21:24:35 UTC (rev 28695)
@@ -126,7 +126,7 @@
type=self.type,
name=self.name,
id=self.name,
- value=self._getFormValue(),
+ value=self._getFormValue() or '',
cssClass=self.cssClass,
style=self.style,
size=self.displayWidth,
@@ -137,7 +137,7 @@
type=self.type,
name=self.name,
id=self.name,
- value=self._getFormValue(),
+ value=self._getFormValue() or '',
cssClass=self.cssClass,
style=self.style,
size=self.displayWidth,
More information about the Zope3-Checkins
mailing list