[Zope3-checkins] SVN: Zope3/branches/3.2/ Merged revision 41612 from the trunk:

Dmitry Vasiliev dima at hlabs.spb.ru
Mon Feb 13 07:15:51 EST 2006


Log message for revision 41613:
  Merged revision 41612 from the trunk:
  
  Fixed issue 544: VocabularyRegistryError missing import.
  

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

-=-
Modified: Zope3/branches/3.2/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.2/doc/CHANGES.txt	2006-02-13 11:47:31 UTC (rev 41612)
+++ Zope3/branches/3.2/doc/CHANGES.txt	2006-02-13 12:15:50 UTC (rev 41613)
@@ -10,6 +10,10 @@
 
     Bug fixes
 
+      - Fixed issue 544: VocabularyRegistryError missing import.
+
+      - Fixed issue 536: ErrorLogUtility has UnboundLocalError.
+
       - zope.app.testing.functional.defineLayer
 
         + Use the method param instead of an hardcoded value for the
@@ -19,8 +23,6 @@
 
     Bug Fixes
 
-      - Fixed issue 536: ErrorLogUtility has UnboundLocalError.
-
       - zope.i18n.interpolate:
 
         + now if the variable wasn't found in the mapping no substitution

Modified: Zope3/branches/3.2/src/zope/schema/_field.py
===================================================================
--- Zope3/branches/3.2/src/zope/schema/_field.py	2006-02-13 11:47:31 UTC (rev 41612)
+++ Zope3/branches/3.2/src/zope/schema/_field.py	2006-02-13 12:15:50 UTC (rev 41613)
@@ -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/branches/3.2/src/zope/schema/tests/test_choice.py
===================================================================
--- Zope3/branches/3.2/src/zope/schema/tests/test_choice.py	2006-02-13 11:47:31 UTC (rev 41612)
+++ Zope3/branches/3.2/src/zope/schema/tests/test_choice.py	2006-02-13 12:15:50 UTC (rev 41613)
@@ -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