[Zope3-checkins] CVS: Zope3/src/zope/schema - accessors.py:1.2

Jim Fulton jim@zope.com
Fri, 18 Apr 2003 18:13:05 -0400


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

Modified Files:
	accessors.py 
Log Message:
In prepration for the upcoming interface changes, I added some
new functions for making interface assertions on instances.  

Rather than:

  class C:

     __class_implements__ = I1, I2

use:

  class C:

     classProvides(I1, I2)

rather than:

__implements__ = I1, I2

use:

moduleProvides(I1, I2)

rather than:

someinstance.__implements__ = I1, I2

use:

directlyProvides(I1, I2)

Note that interface assertions on persistent objects should be aboided
since the internal representation will change.

Continue to make assertions about the interfaces that class instances
implement the same way:

  class C:

     __implements__ = I1, I2


I also modified the core software to use the new spellings.



=== Zope3/src/zope/schema/accessors.py 1.1 => 1.2 ===
--- Zope3/src/zope/schema/accessors.py:1.1	Mon Apr 14 04:21:16 2003
+++ Zope3/src/zope/schema/accessors.py	Fri Apr 18 18:12:33 2003
@@ -40,6 +40,7 @@
 
 from __future__ import generators
 
+from zope.interface import directlyProvides
 from zope.interface.interface import Method
 
 class FieldReadAccessor(Method):
@@ -54,7 +55,7 @@
         self.field = field
         Method.__init__(self, '')
         self.__doc__ = 'get %s' % field.__doc__
-        self.__implements__ = field.__implements__, Method.__implements__
+        directlyProvides(self, field.__implements__, Method.__implements__)
 
     def getSignatureString(self):
         return '()'