[Checkins] SVN: zope.schema/trunk/src/zope/schema/ Explicitly catch ImportErrors

Jan Carel Brand cvs-admin at zope.org
Thu Mar 22 11:14:26 UTC 2012


Log message for revision 124689:
  Explicitly catch ImportErrors

Changed:
  U   zope.schema/trunk/src/zope/schema/tests/test_vocabulary.py
  U   zope.schema/trunk/src/zope/schema/vocabulary.py

-=-
Modified: zope.schema/trunk/src/zope/schema/tests/test_vocabulary.py
===================================================================
--- zope.schema/trunk/src/zope/schema/tests/test_vocabulary.py	2012-03-22 11:13:54 UTC (rev 124688)
+++ zope.schema/trunk/src/zope/schema/tests/test_vocabulary.py	2012-03-22 11:14:22 UTC (rev 124689)
@@ -17,7 +17,7 @@
 
 try:
     from collections import OrderedDict
-except:
+except ImportError:
     from ordereddict import OrderedDict
 
 from zope.interface.verify import verifyObject

Modified: zope.schema/trunk/src/zope/schema/vocabulary.py
===================================================================
--- zope.schema/trunk/src/zope/schema/vocabulary.py	2012-03-22 11:13:54 UTC (rev 124688)
+++ zope.schema/trunk/src/zope/schema/vocabulary.py	2012-03-22 11:14:22 UTC (rev 124689)
@@ -15,7 +15,7 @@
 """
 try:
     from collections import OrderedDict
-except:
+except ImportError:
     from ordereddict import OrderedDict
 
 from zope.interface.declarations import directlyProvides, implementer
@@ -162,7 +162,7 @@
     """
     # The default implementation uses a dict to create the tree structure. This
     # can however be overridden in a subclass by any other IEnumerableMapping
-    # compliant object type. Python 2.7's OrderableDict for example.
+    # compliant object type. Python 2.7's OrderedDict for example.
     terms_factory = OrderedDict
 
     def __init__(self, terms, *interfaces):
@@ -213,7 +213,7 @@
         return self._terms.__iter__()
 
     def __len__(self):
-        """x.__iter__() <==> iter(x)
+        """x.__len__() <==> len(x)
         """
         return self._terms.__len__()
 



More information about the checkins mailing list