[Zope3-checkins] SVN: Zope3/trunk/ Fixed issue 544: VocabularyRegistryError missing import.

Dmitry Vasiliev dima at hlabs.spb.ru
Mon Feb 13 06:47:32 EST 2006


Log message for revision 41612:
  Fixed issue 544: VocabularyRegistryError missing import.
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/schema/_field.py
  U   Zope3/trunk/src/zope/schema/tests/test_choice.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2006-02-13 00:44:23 UTC (rev 41611)
+++ Zope3/trunk/doc/CHANGES.txt	2006-02-13 11:47:31 UTC (rev 41612)
@@ -38,6 +38,8 @@
 
     Bug Fixes
 
+      - Fixed issue 544: VocabularyRegistryError missing import.
+
       - Fixed issue 536: ErrorLogUtility has UnboundLocalError.
 
       - zope.i18n.interpolate:

Modified: Zope3/trunk/src/zope/schema/_field.py
===================================================================
--- Zope3/trunk/src/zope/schema/_field.py	2006-02-13 00:44:23 UTC (rev 41611)
+++ Zope3/trunk/src/zope/schema/_field.py	2006-02-13 11:47:31 UTC (rev 41612)
@@ -15,13 +15,14 @@
 
 $Id$
 """
+
 __docformat__ = 'restructuredtext'
-import warnings
+
 import re
 from datetime import datetime, date, timedelta
 from sets import Set as SetType
 
-from zope.interface import classImplements, implements, directlyProvides
+from zope.interface import classImplements, implements
 from zope.interface.interfaces import IInterface, IMethod
 
 from zope.schema.interfaces import IField
@@ -41,16 +42,16 @@
 from zope.schema.interfaces import SchemaNotProvided, SchemaNotFullyImplemented
 from zope.schema.interfaces import InvalidURI, InvalidId, InvalidDottedName
 from zope.schema.interfaces import ConstraintNotSatisfied
-from zope.schema.interfaces import Unbound
 
 from zope.schema._bootstrapfields import Field, Container, Iterable, Orderable
+from zope.schema._bootstrapfields import Text, TextLine, Bool, Int, Password
 from zope.schema._bootstrapfields import MinMaxLen
-from zope.schema._bootstrapfields import Text, TextLine, Bool, Int, Password
-from zope.schema._bootstrapfields import MinMaxLen, ValidatedProperty
 from zope.schema.fieldproperty import FieldProperty
 from zope.schema.vocabulary import getVocabularyRegistry
-from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
+from zope.schema.vocabulary import VocabularyRegistryError
+from zope.schema.vocabulary import SimpleVocabulary
 
+
 # Fix up bootstrap field types
 Field.title       = FieldProperty(IField['title'])
 Field.description = FieldProperty(IField['description'])
@@ -455,6 +456,7 @@
     r"[a-zA-z0-9+.-]+:"   # scheme
     r"\S*$"               # non space (should be pickier)
     ).match
+
 class URI(BytesLine):
     """URI schema field
     """
@@ -651,7 +653,7 @@
             raise InvalidDottedName("too few dots; %d required" % self.min_dots,
                                     value)
         if self.max_dots is not None and dots > self.max_dots:
-            raise InvalidDottedName("too many dots; no more than %d allowed" % 
+            raise InvalidDottedName("too many dots; no more than %d allowed" %
                                     self.max_dots, value)
 
     def fromUnicode(self, value):

Modified: Zope3/trunk/src/zope/schema/tests/test_choice.py
===================================================================
--- Zope3/trunk/src/zope/schema/tests/test_choice.py	2006-02-13 00:44:23 UTC (rev 41611)
+++ Zope3/trunk/src/zope/schema/tests/test_choice.py	2006-02-13 11:47:31 UTC (rev 41612)
@@ -60,7 +60,6 @@
         choice.validate((0.2,))
         self.assertRaises(ConstraintNotSatisfied, choice.validate, '1')
         self.assertRaises(ConstraintNotSatisfied, choice.validate, 0.2)
-    
 
 class Vocabulary_ChoiceFieldTests(unittest.TestCase):
     """Tests of the Choice Field using vocabularies."""
@@ -109,7 +108,11 @@
         self.assertEqual([term.value for term in bound.vocabulary],
                          [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 
+    def test_undefined_vocabulary(self):
+        choice = Choice(vocabulary="unknown")
+        self.assertRaises(ValueError, choice.validate, "value")
 
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(Vocabulary_ChoiceFieldTests))



More information about the Zope3-Checkins mailing list