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

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


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

Modified Files:
	vocabulary.py 
Log Message:
Vocabulary fields never need to worry about tokens; they aren't
particularly relevant at this level.


=== Zope3/src/zope/schema/vocabulary.py 1.13 => 1.14 ===
--- Zope3/src/zope/schema/vocabulary.py:1.13	Thu Jun  5 12:13:38 2003
+++ Zope3/src/zope/schema/vocabulary.py	Thu Jun  5 12:54:04 2003
@@ -59,12 +59,6 @@
             # XXX can't validate without vocabulary, and can't get
             # vocabulary without context
             return
-        if IVocabularyTokenized.isImplementedBy(self.vocabulary):
-            # Get the term value from the provided token value
-            try:
-                value = self.vocabulary.getTermByToken(value).value
-            except LookupError:
-                raise ValidationError(errornames.ConstraintNotSatisfied, v)
         if value not in self.vocabulary:
             raise ValidationError(errornames.ConstraintNotSatisfied,
                                   value)
@@ -96,16 +90,6 @@
         vocab = self.vocabulary
         if vocab is None:
             raise ValueError("can't validate value without vocabulary")
-        if IVocabularyTokenized.isImplementedBy(vocab):
-            # Get the term values from the provided token values
-            for token in value:
-                try:
-                    v = vocab.getTermByToken(token).value
-                except LookupError:
-                    raise ValidationError(errornames.ConstraintNotSatisfied,
-                                          "token: " + repr(token))
-                if v not in vocab:
-                    raise ValidationError(errornames.ConstraintNotSatisfied, v)
         for v in value:
             if v not in vocab:
                 raise ValidationError(errornames.ConstraintNotSatisfied, v)