[Zope3-checkins] CVS: Zope3/src/zope/schema - vocabulary.py:1.13

Fred L. Drake, Jr. fred@zope.com
Thu, 5 Jun 2003 12:13:38 -0400


Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv23570

Modified Files:
	vocabulary.py 
Log Message:
When raising an exception, provide the information for the broken
value, not the previous (acceptable) value checked.  When the first
value was broken, this triggered an UnboundLocalError.


=== Zope3/src/zope/schema/vocabulary.py 1.12 => 1.13 ===
--- Zope3/src/zope/schema/vocabulary.py:1.12	Wed Jun  4 14:09:07 2003
+++ Zope3/src/zope/schema/vocabulary.py	Thu Jun  5 12:13:38 2003
@@ -102,7 +102,8 @@
                 try:
                     v = vocab.getTermByToken(token).value
                 except LookupError:
-                    raise ValidationError(errornames.ConstraintNotSatisfied, v)
+                    raise ValidationError(errornames.ConstraintNotSatisfied,
+                                          "token: " + repr(token))
                 if v not in vocab:
                     raise ValidationError(errornames.ConstraintNotSatisfied, v)
         for v in value: