[Zope3-checkins] CVS: Zope3/src/zope/app/browser/component -
interfacewidget.py:1.35
Sidnei da Silva
sidnei at x3ng.com.br
Fri Aug 8 17:53:40 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/component
In directory cvs.zope.org:/tmp/cvs-serv4920
Modified Files:
interfacewidget.py
Log Message:
Save error before raising it, so we see the error on the form
=== Zope3/src/zope/app/browser/component/interfacewidget.py 1.34 => 1.35 ===
--- Zope3/src/zope/app/browser/component/interfacewidget.py:1.34 Thu Aug 7 15:06:15 2003
+++ Zope3/src/zope/app/browser/component/interfacewidget.py Fri Aug 8 16:53:36 2003
@@ -48,8 +48,9 @@
if value is self or value == '':
# No user input
if field.required and not optional:
- raise MissingInputError(field.__name__, field.title,
- _(u'the field is required'))
+ self.error = MissingInputError(field.__name__, field.title,
+ [_(u'the field is required')])
+ raise self.error
return field.default
if value == 'None':
value = None
@@ -59,14 +60,16 @@
except ComponentLookupError:
# Convert to conversion error
exc = ConversionError(sys.exc_info()[1])
- raise ConversionError, exc, sys.exc_info()[2]
+ self.error = ConversionError, exc, sys.exc_info()[2]
+ raise self.error
if not optional:
try:
field.validate(value)
except ValidationError, v:
- raise WidgetInputError(self.context.__name__,
- self.title, str(v))
+ self.error = WidgetInputError(self.context.__name__,
+ self.title, [str(v)])
+ raise self.error
return value
@@ -168,22 +171,25 @@
if not values:
# No user input
if field.required and not optional:
- raise MissingInputError(field.__name__, field.title,
- _(u'the field is required'))
+ self.error = MissingInputError(field.__name__, field.title,
+ [_(u'the field is required')])
+ raise self.error
return field.default
try:
values = tuple([nameToInterface(field, value) for value in values])
except ComponentLookupError:
# Convert to conversion error
exc = ConversionError(sys.exc_info()[1])
- raise ConversionError, exc, sys.exc_info()[2]
+ self.error = ConversionError, exc, sys.exc_info()[2]
+ raise self.error
if not optional:
try:
field.validate(values)
except ValidationError, v:
- raise WidgetInputError(self.context.__name__,
- self.title, str(v))
+ self.error = WidgetInputError(self.context.__name__,
+ self.title, str(v))
+ raise self.error
return values
def __call__(self):
@@ -306,12 +312,6 @@
self.name,
self._tooltip(self.title, self.context.description),
)
- '''
- def row(self):
- return '<div class="label">%s</div><div class="field">%s</div>%s' % (
- self.label(), self(), self._errorSnippet()
- )
- '''
# --- deprecated methods of IBrowserWidget
More information about the Zope3-Checkins
mailing list