[Zope3-checkins] CVS: Zope3/src/zope/schema - _bootstrapfields.py:1.15 _field.py:1.13 accessors.py:1.3

Jim Fulton jim@zope.com
Sat, 3 May 2003 12:36:06 -0400


Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv24176/src/zope/schema

Modified Files:
	_bootstrapfields.py _field.py accessors.py 
Log Message:
Updated to use new interface declaration machinery.



=== Zope3/src/zope/schema/_bootstrapfields.py 1.14 => 1.15 ===
--- Zope3/src/zope/schema/_bootstrapfields.py:1.14	Tue Apr 22 14:02:56 2003
+++ Zope3/src/zope/schema/_bootstrapfields.py	Sat May  3 12:36:05 2003
@@ -18,8 +18,7 @@
 
 import warnings
 
-from zope.interface import Attribute
-from zope.interface.implements import visitImplements
+from zope.interface import Attribute, providedBy
 
 from zope.schema.interfaces import StopValidation, ValidationError
 from zope.schema._schema import getFields
@@ -104,10 +103,12 @@
         # should be the same type
         if type(self) != type(other):
             return False
+
         # should have the same properties
         names = {} # used as set of property names, ignoring values
-        visitImplements(self.__implements__, self,
-                        lambda interface: names.update(getFields(interface)))
+        for interface in providedBy(self):
+            names.update(getFields(interface))
+            
         # order will be different always, don't compare it
         if 'order' in names:
             del names['order']


=== Zope3/src/zope/schema/_field.py 1.12 => 1.13 ===
--- Zope3/src/zope/schema/_field.py:1.12	Thu Apr 24 16:51:58 2003
+++ Zope3/src/zope/schema/_field.py	Sat May  3 12:36:05 2003
@@ -18,7 +18,7 @@
 
 import warnings
 
-from zope.interface.implements import implements
+from zope.interface import classImplements
 from zope.interface.interfaces import IInterface
 
 from zope.schema.interfaces import ValidationError
@@ -47,18 +47,18 @@
 Field.required    = FieldProperty(IField['required'])
 Field.readonly    = FieldProperty(IField['readonly'])
 # Default is already taken care of
-implements(Field, IField)
+classImplements(Field, IField)
 
 MinMaxLen.min_length = FieldProperty(IMinMaxLen['min_length'])
 MinMaxLen.max_length = FieldProperty(IMinMaxLen['max_length'])
 
-implements(Text, IText)
-implements(TextLine, ITextLine)
-implements(Password, IPassword)
-implements(Bool, IBool)
-implements(Int, IInt)
-implements(EnumeratedInt, IEnumeratedInt)
-implements(EnumeratedTextLine, IEnumeratedTextLine)
+classImplements(Text, IText)
+classImplements(TextLine, ITextLine)
+classImplements(Password, IPassword)
+classImplements(Bool, IBool)
+classImplements(Int, IInt)
+classImplements(EnumeratedInt, IEnumeratedInt)
+classImplements(EnumeratedTextLine, IEnumeratedTextLine)
 
 class SourceText(Text):
     __doc__ = ISourceText.__doc__


=== Zope3/src/zope/schema/accessors.py 1.2 => 1.3 ===
--- Zope3/src/zope/schema/accessors.py:1.2	Fri Apr 18 18:12:33 2003
+++ Zope3/src/zope/schema/accessors.py	Sat May  3 12:36:05 2003
@@ -40,8 +40,10 @@
 
 from __future__ import generators
 
+from zope.interface import providedBy
 from zope.interface import directlyProvides
 from zope.interface.interface import Method
+        
 
 class FieldReadAccessor(Method):
     """Field read accessor
@@ -51,11 +53,14 @@
     # A read accessor is a decorator of a field, using the given
     # fields proprtyoes to provide meta data.
 
+    def __provides__(self):
+        return providedBy(self.field)
+    __provides__ = property(__provides__)
+
     def __init__(self, field):
         self.field = field
         Method.__init__(self, '')
         self.__doc__ = 'get %s' % field.__doc__
-        directlyProvides(self, field.__implements__, Method.__implements__)
 
     def getSignatureString(self):
         return '()'