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

Jim Fulton jim@zope.com
Thu, 24 Oct 2002 06:07:51 -0400


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

Modified Files:
      Tag: Zope3-Bangalore-TTW-Branch
	ContentDirective.py 
Log Message:
Added more automatic interface registration while refering to
interfaces in component registration directives.

In doing this I was forced to clean up the configuratio files outside
of Zope.App. In particular, there shouldn't be any configuration files
outside of Zope.App and Zope.Configuration. This second task was much
more involved than the first. :/




=== Zope3/lib/python/Zope/App/ContentDirective/ContentDirective.py 1.8 => 1.8.6.1 ===
--- Zope3/lib/python/Zope/App/ContentDirective/ContentDirective.py:1.8	Tue Oct  1 08:47:49 2002
+++ Zope3/lib/python/Zope/App/ContentDirective/ContentDirective.py	Thu Oct 24 06:07:20 2002
@@ -33,6 +33,10 @@
     """Security-protection-specific exceptions."""
     pass
 
+def handler(serviceName, methodName, *args, **kwargs):
+    method=getattr(getService(None, serviceName), methodName)
+    method(*args, **kwargs)
+
 class ContentDirective:
 
     __implements__ = INonEmptyDirective
@@ -56,7 +60,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,