[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/Browser - metaConfigure.py:1.1.2.13

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


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

Modified Files:
      Tag: Zope-3x-branch
	metaConfigure.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/Publisher/Browser/metaConfigure.py 1.1.2.12 => 1.1.2.13 ===
 from Zope.ComponentArchitecture import provideView, defineSkin, provideResource
 from Zope.ComponentArchitecture import setDefaultViewName
-from Zope.Configuration.name import resolve
 from Zope.Configuration.Action import Action
 from IBrowserPublisher import IBrowserPublisher
 
-def defaultView(name, factory, for_=None, layer=''):
+def defaultView(_context, name, factory, for_=None, layer=''):
     if for_ is not None:
-        for_ = resolve(for_)
-    factory = map(resolve, factory.split(' '))
+        for_ = _context.resolve(for_)
+    factory = map(_context.resolve, factory.split(' '))
     
     return [
         Action(
@@ -30,10 +29,10 @@
             )
         ]
     
-def view(name, factory, for_=None, layer=''):
+def view(_context, name, factory, for_=None, layer=''):
     if for_ is not None:
-        for_ = resolve(for_)
-    factory = map(resolve, factory.split(' '))
+        for_ = _context.resolve(for_)
+    factory = map(_context.resolve, factory.split(' '))
 
     return [
         Action(
@@ -43,7 +42,7 @@
             )
         ]
 
-def skin(name, layers):
+def skin(_context, name, layers):
     layers = [layer.strip() for layer in layers.split(',')]
     return [
         Action(
@@ -53,9 +52,9 @@
             )
         ]
 
-def resource(component, name, layer=''):
+def resource(_context, component, name, layer=''):
     type = IBrowserPublisher
-    component = resolve(component)
+    component = _context.resolve(component)
     return [
         Action(
             discriminator = ('resource', name, type, layer),