[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ContentDirective - ContentDirective.py:1.11

Jim Fulton jim@zope.com
Tue, 19 Nov 2002 18:25:43 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/ContentDirective
In directory cvs.zope.org:/tmp/cvs-serv11465/lib/python/Zope/App/ContentDirective

Modified Files:
	ContentDirective.py 
Log Message:

Two changes that were far reaching and interdependent.

- Changed existing directives that mention interfaces to register
  those interfaces with the global interface service.

- Moved all configuration support (except that in Zope.Configuration)
  into Zope.App. This was necessary to get the order of execution such
  that the interface service was defined before directives that used
  interfaces were used.  This is a change that has been needed for
  some time.



=== Zope3/lib/python/Zope/App/ContentDirective/ContentDirective.py 1.10 => 1.11 ===
--- Zope3/lib/python/Zope/App/ContentDirective/ContentDirective.py:1.10	Mon Nov 11 15:13:49 2002
+++ Zope3/lib/python/Zope/App/ContentDirective/ContentDirective.py	Tue Nov 19 18:25:12 2002
@@ -35,6 +35,10 @@
     """Security-protection-specific exceptions."""
     pass
 
+def handler(serviceName, methodName, *args, **kwargs):
+    method=getattr(getService(None, serviceName), methodName)
+    method(*args, **kwargs)
+
 class ContentDirective:
 
     __class_implements__ = INonEmptyDirective
@@ -59,7 +63,16 @@
                 # the last argument is check=1, which causes implements
                 # to verify that the class does implement the interface
                 args = (self.__class, resolved_interface, 1),
-                )
+                ),
+            Action(
+               discriminator = None,
+               callable = handler,
+               args = ('Interfaces', 'provideInterface',
+                       resolved_interface.__module__+
+                       '.'+
+                       resolved_interface.__name__,
+                       resolved_interface)
+               )
             ]
 
     def require(self, _context,