[Zope3-checkins] SVN: Zope3/branches/3.3/ - verified fix for issue 565 and provided test

Christian Theune cvs-admin at zope.org
Sat Jun 17 18:10:08 EDT 2006


Log message for revision 68721:
   - verified fix for issue 565 and provided test 
  

Changed:
  U   Zope3/branches/3.3/doc/CHANGES.txt
  U   Zope3/branches/3.3/src/zope/app/form/browser/tests/test_objectwidget.py

-=-
Modified: Zope3/branches/3.3/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.3/doc/CHANGES.txt	2006-06-17 22:00:16 UTC (rev 68720)
+++ Zope3/branches/3.3/doc/CHANGES.txt	2006-06-17 22:10:04 UTC (rev 68721)
@@ -9,7 +9,10 @@
   Zope 3.3.0b2 (UNRELEASED)
 
     Bugfixes
-
+    
+      - Fixed issue 565: Verified fix for ObjectWidget's 'error' method and
+        provided test coverage.
+    
       - Fixed issue 559: Removed filtering of CGI names when used as form
         fields
 

Modified: Zope3/branches/3.3/src/zope/app/form/browser/tests/test_objectwidget.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/form/browser/tests/test_objectwidget.py	2006-06-17 22:00:16 UTC (rev 68720)
+++ Zope3/branches/3.3/src/zope/app/form/browser/tests/test_objectwidget.py	2006-06-17 22:10:04 UTC (rev 68721)
@@ -23,10 +23,11 @@
 from zope.schema.interfaces import ITextLine
 from zope.publisher.browser import TestRequest
 from zope.schema import Object, TextLine
-from zope.app.form.interfaces import IInputWidget
+from zope.app.form.interfaces import IInputWidget, MissingInputError
 from zope.app.form.browser import TextWidget, ObjectWidget
 from zope.interface.verify import verifyClass
 from zope.app.form.browser.tests.test_browserwidget import BrowserWidgetTest
+from zope.app.form.browser.interfaces import IWidgetInputErrorView
 
 class ITestContact(Interface):
     name = TextLine()
@@ -35,6 +36,16 @@
 class TestContact(object):
     implements(ITestContact)
 
+class ObjectWidgetInputErrorView(object):
+    implements(IWidgetInputErrorView)
+
+    def __init__(self, error, request):
+        self.error = error
+        self.request = request
+
+    def snippet(self):
+        return repr(self.error)
+
 class ObjectWidgetTest(BrowserWidgetTest):
     """Documents and tests the object widget.
         
@@ -81,6 +92,18 @@
         self.assertEqual(self.content.foo.name, u'Foo Name')
         self.assertEqual(self.content.foo.email, u'foo at foo.test')
 
+    def test_error(self):
+        ztapi.provideAdapter(
+                required=(MissingInputError, TestRequest),
+                provided=IWidgetInputErrorView,
+                factory=ObjectWidgetInputErrorView)
+
+        widget = self._WidgetFactory(self.field, self.request)
+        self.assertRaises(MissingInputError, widget.getInputValue)
+        error_html = widget.error()
+        self.failUnless("email: <zope.app.form.interfaces.Mis" in error_html)
+        self.failUnless("name: <zope.app.form.interfaces.Miss" in error_html)
+
     def test_applyChangesNoChange(self):
         self.content.foo = TestContact()
         self.content.foo.name = u'Foo Name'



More information about the Zope3-Checkins mailing list