[Checkins] SVN: zope.schema/branches/3.4.1/src/zope/schema/ refactored code based on suggestion provided by Jim.

Satchidanand Haridas satchit at zope.com
Fri Mar 20 16:24:09 EDT 2009


Log message for revision 98291:
  refactored code based on suggestion provided by Jim.
  
  

Changed:
  U   zope.schema/branches/3.4.1/src/zope/schema/_bootstrapfields.py
  U   zope.schema/branches/3.4.1/src/zope/schema/tests/test_field.py

-=-
Modified: zope.schema/branches/3.4.1/src/zope/schema/_bootstrapfields.py
===================================================================
--- zope.schema/branches/3.4.1/src/zope/schema/_bootstrapfields.py	2009-03-20 19:59:16 UTC (rev 98290)
+++ zope.schema/branches/3.4.1/src/zope/schema/_bootstrapfields.py	2009-03-20 20:24:08 UTC (rev 98291)
@@ -165,9 +165,8 @@
             # the complexity of the next few lines of code is required to make
             # it proxy aware
             if isinstance(self._type, tuple):
-                check_mro = [
-                    _type in value.__class__.__mro__ for _type in self._type]
-                if True not in check_mro:
+                if not [type_ for type_ in self._type
+                        if type_ in value.__class__.__mro__]:
                     raise WrongType(value, self._type)
             elif self._type not in value.__class__.__mro__:
                 raise WrongType(value, self._type)

Modified: zope.schema/branches/3.4.1/src/zope/schema/tests/test_field.py
===================================================================
--- zope.schema/branches/3.4.1/src/zope/schema/tests/test_field.py	2009-03-20 19:59:16 UTC (rev 98290)
+++ zope.schema/branches/3.4.1/src/zope/schema/tests/test_field.py	2009-03-20 20:24:08 UTC (rev 98291)
@@ -145,9 +145,9 @@
         self.proxied_object = fld
 
     def __getattribute__(self, name):
-        if name in ['proxied_object']:
+        if name == 'proxied_object':
             val = object.__getattribute__(self, name)
-        elif name in ['__class__']:
+        elif name == '__class__':
             val = StubProxy(getattr(self.proxied_object, name))
         else:
             val = getattr(self.proxied_object, name)



More information about the Checkins mailing list