[Checkins] SVN: zope.schema/branches/tseaver-test_cleanup/src/zope/schema/_field.py Factor out common case.

Tres Seaver cvs-admin at zope.org
Mon Apr 23 22:00:04 UTC 2012


Log message for revision 125263:
  Factor out common case.

Changed:
  U   zope.schema/branches/tseaver-test_cleanup/src/zope/schema/_field.py

-=-
Modified: zope.schema/branches/tseaver-test_cleanup/src/zope/schema/_field.py
===================================================================
--- zope.schema/branches/tseaver-test_cleanup/src/zope/schema/_field.py	2012-04-23 21:59:56 UTC (rev 125262)
+++ zope.schema/branches/tseaver-test_cleanup/src/zope/schema/_field.py	2012-04-23 22:00:00 UTC (rev 125263)
@@ -346,14 +346,13 @@
         # get registered vocabulary if needed:
         if IContextSourceBinder.providedBy(self.vocabulary):
             clone.vocabulary = self.vocabulary(object)
-            if not ISource.providedBy(clone.vocabulary):
-                raise ValueError('Invalid clone vocabulary')
         elif clone.vocabulary is None and self.vocabularyName is not None:
             vr = getVocabularyRegistry()
             clone.vocabulary = vr.get(object, self.vocabularyName)
-            if not ISource.providedBy(clone.vocabulary):
-                raise ValueError('Invalid clone vocabulary')
 
+        if not ISource.providedBy(clone.vocabulary):
+            raise ValueError('Invalid clone vocabulary')
+
         return clone
 
     def fromUnicode(self, str):



More information about the checkins mailing list