[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - IconDirective.py:1.1.2.3 TabsDirective.py:1.1.2.5 provideClass.py:1.1.2.12

Jim Fulton jim@zope.com
Tue, 26 Mar 2002 19:47:15 -0500


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

Modified Files:
      Tag: Zope-3x-branch
	IconDirective.py TabsDirective.py provideClass.py 
Log Message:
Merged in changes from contextual-directives branch.

Now, a leading dot in a dotted name implies the package the include
file was included from. It still defaults to ZopeProducts if a file 
was not included via a package.

A few of the config files have been convered to use the
shorthand. The rest still can be converted.

I also checked this against Step 6 in the tutorial, which I will check
in in a moment.


=== Zope3/lib/python/Zope/App/ZMI/IconDirective.py 1.1.2.2 => 1.1.2.3 ===
 """
 
-def IconDirective(for_, file):
+def IconDirective(_context, for_, file):
     #stub
     return ()


=== Zope3/lib/python/Zope/App/ZMI/TabsDirective.py 1.1.2.4 => 1.1.2.5 ===
 
 from Zope.Configuration.Action import Action
-from Zope.Configuration.name import resolve
 
 #from ComponentArchitecture import getService
 from ZMIViewService import ZMIViews
@@ -28,10 +27,10 @@
 
     __implements__ = INonEmptyDirective
 
-    def __init__(self, for_):
-        self._for_ = resolve(for_)
+    def __init__(self, _context, for_):
+        self._for_ = _context.resolve(for_)
 
-    def tab(self, label, action, filter='python: 1'):
+    def tab(self, _context, label, action, filter='python: 1'):
         return [
             Action(
                discriminator =('tab', self._for_, label),


=== Zope3/lib/python/Zope/App/ZMI/provideClass.py 1.1.2.11 => 1.1.2.12 ===
 from Zope.ComponentArchitecture.IFactory import IFactory
 from Zope.ComponentArchitecture import provideFactory
-from Zope.Configuration.name import resolve
 import Addable
 
 class ClassFactory:
@@ -47,18 +46,18 @@
     provideFactory(qualified_name, factory)
     registry.provideAddable(qualified_name, title, description)
 
-def ServiceClassDir(name, permission_id, title, description=''):
+def ServiceClassDir(_context, name, permission_id, title, description=''):
     return ((name,
              provideClass,
-             (Addable.ServiceAddables, name, resolve(name),
+             (Addable.ServiceAddables, name, _context.resolve(name),
               permission_id, title, description)
              ),)
 
 
-def ContentClassDir(name, permission_id, title, description=''):
+def ContentClassDir(_context, name, permission_id, title, description=''):
     return ((name,
              provideClass,
-             (Addable.ContentAddables, name, resolve(name),
+             (Addable.ContentAddables, name, _context.resolve(name),
               permission_id, title, description)
              ),)