[Zope3-checkins] CVS: Zope3/src/zope/app/exception/browser -
form.py:1.2
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sun Apr 11 06:34:45 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/exception/browser
In directory cvs.zope.org:/tmp/cvs-serv4521/src/zope/app/exception/browser
Modified Files:
form.py
Log Message:
All ValidationErrors now have a doc() method for returning the user output
string.
=== Zope3/src/zope/app/exception/browser/form.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/exception/browser/form.py:1.1 Sat Mar 13 23:44:51 2004
+++ Zope3/src/zope/app/exception/browser/form.py Sun Apr 11 06:34:44 2004
@@ -15,7 +15,6 @@
$Id$
"""
-
from zope.app.form.interfaces import IWidgetInputError
from cgi import escape
@@ -31,9 +30,13 @@
"""Convert a widget input error to an html snippet
>>> from zope.app.form.interfaces import WidgetInputError
- >>> err = WidgetInputError("foo", "Foo", ["Foo input < 1"])
+ >>> class TooSmallError:
+ ... def doc(self):
+ ... return "Foo input < 1"
+ >>> err = WidgetInputError("foo", "Foo", TooSmallError())
>>> view = WidgetInputErrorView(err, None)
>>> view.snippet()
'<span class="error">Foo input < 1</span>'
"""
- return '<span class="error">%s</span>' % escape(self.context.errors[0])
+ return '<span class="error">%s</span>' %(
+ escape(self.context.errors.doc()))
More information about the Zope3-Checkins
mailing list