[Zope3-checkins] CVS: Zope3/src/zope/configuration/tests - directives.py:1.4

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


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

Modified Files:
	directives.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/configuration/tests/directives.py 1.3 => 1.4 ===
--- Zope3/src/zope/configuration/tests/directives.py:1.3	Mon Dec 30 21:52:12 2002
+++ Zope3/src/zope/configuration/tests/directives.py	Fri Apr 18 18:12:31 2003
@@ -17,6 +17,7 @@
 $Id$
 """
 
+from zope.interface import directlyProvides, classProvides
 from zope.configuration.interfaces import INonEmptyDirective
 from zope.configuration.interfaces import ISubdirectiveHandler
 
@@ -33,7 +34,7 @@
 
 class protectClass:
 
-    __class_implements__ = INonEmptyDirective
+    classProvides(INonEmptyDirective)
     __implements__ = ISubdirectiveHandler
 
     def __init__(self, _context, name, permission=None, names=None):
@@ -66,7 +67,7 @@
         #If you put a protect inside a subsub, that'll set children,
         #so when the parser calls us, __call__ will return ().
         return self
-    subsub.__implements__ = INonEmptyDirective
+    directlyProvides(subsub, INonEmptyDirective)
 
 done = []