[Zope3-checkins] CVS: Zope3/src/zope/schema - _field.py:1.5
R. David Murray
bitz@bitdance.com
Fri, 24 Jan 2003 23:05:48 -0500
Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv23325
Modified Files:
_field.py
Log Message:
I couldn't figure out any purpose being served by the try/finally
in Sequence's _validate. So I added some extra Sequence/Tuple unit
tests (previous checkin), and took out the try/finally. All the
tests still pass, so either this code was indeed useless, or no unit
test tested that code path. If someone knows it was not useless,
please add a unit test and restore the logic.
=== Zope3/src/zope/schema/_field.py 1.4 => 1.5 ===
--- Zope3/src/zope/schema/_field.py:1.4 Fri Jan 24 22:14:16 2003
+++ Zope3/src/zope/schema/_field.py Fri Jan 24 23:05:45 2003
@@ -118,23 +118,22 @@
def _validate(self, value):
super(Sequence, self)._validate(value)
- try:
- errors = _validate_sequence(self.value_types, value)
- if errors:
- raise ValidationError(WrongContainedType, errors)
+ errors = _validate_sequence(self.value_types, value)
+ if errors:
+ raise ValidationError(WrongContainedType, errors)
- finally:
- errors = None
class Tuple(Sequence):
"""A field representing a Tuple."""
__implements__ = ITuple
_type = tuple
+
class List(Sequence):
"""A field representing a List."""
__implements__ = IList
_type = list
+
class Dict(MinMaxLen, Iterable):
"""A field representing a Dict."""