[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - metaconfigure.py:1.1 metadirectives.py:1.1 configure.zcml:1.10 meta.zcml:1.4 namespace.py:1.16

Stephan Richter srichter@cosmos.phy.tufts.edu
Sat, 2 Aug 2003 14:17:59 -0400


Update of /cvs-repository/Zope3/src/zope/app/traversing
In directory cvs.zope.org:/tmp/cvs-serv13715

Modified Files:
	configure.zcml meta.zcml namespace.py 
Added Files:
	metaconfigure.py metadirectives.py 
Log Message:
Converted traversalNamespace ZCML directive. Added a test for it too.


=== Added File Zope3/src/zope/app/traversing/metaconfigure.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Renderer configuration code

$Id: metaconfigure.py,v 1.1 2003/08/02 18:17:25 srichter Exp $
"""
from namespace import provideNamespaceHandler

def traversalNamespace(_context, name, handler):
    _context.action(
        discriminator=("traversalNamespace", name),
        callable=provideNamespaceHandler,
        args=(name, handler) )



=== Added File Zope3/src/zope/app/traversing/metadirectives.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""'traversalNamespace' directive handler

$Id: metadirectives.py,v 1.1 2003/08/02 18:17:25 srichter Exp $
"""
from zope.configuration.fields import GlobalObject, PythonIdentifier
from zope.interface import Interface

class ITraversalNamespaceDirective(Interface):
    """Register a new traversal namespace."""
    
    name = PythonIdentifier(
        title=u"Name",
        description=u"The name under which the namespace will be accessible.",
        required=True)

    handler = GlobalObject(
        title=u"Handler",
        description=u"Specifies the handler component for this namespace.",
        required=True)


=== Zope3/src/zope/app/traversing/configure.zcml 1.9 => 1.10 ===
--- Zope3/src/zope/app/traversing/configure.zcml:1.9	Wed Jul  2 07:00:16 2003
+++ Zope3/src/zope/app/traversing/configure.zcml	Sat Aug  2 14:17:25 2003
@@ -1,63 +1,59 @@
-<zopeConfigure
-   xmlns='http://namespaces.zope.org/zope'
-   xmlns:browser='http://namespaces.zope.org/browser'
->
-
-<adapter for="*"
-         factory="zope.app.traversing.adapters.Traverser"
-         provides="zope.app.interfaces.traversing.ITraverser"
-         />
-
-<adapter for="*"
-         factory="zope.app.traversing.adapters.DefaultTraversable"
-         provides="zope.app.interfaces.traversing.ITraversable" />
+<configure xmlns="http://namespaces.zope.org/zope">
+
+<adapter 
+    for="*"
+    factory="zope.app.traversing.adapters.Traverser"
+    provides="zope.app.interfaces.traversing.ITraverser" />
+
+<adapter 
+    for="*"
+    factory="zope.app.traversing.adapters.DefaultTraversable"
+    provides="zope.app.interfaces.traversing.ITraversable" />
 
 <adapter 
     for="*"
     provides="zope.app.interfaces.traversing.IPhysicallyLocatable"
-    factory="zope.app.traversing.adapters.WrapperPhysicallyLocatable" 
-    />
+    factory="zope.app.traversing.adapters.WrapperPhysicallyLocatable" />
 
 <adapter 
     provides="zope.app.interfaces.traversing.IPhysicallyLocatable"
     for="zope.app.interfaces.traversing.IContainmentRoot"
-    factory="zope.app.traversing.adapters.RootPhysicallyLocatable" 
-    />
+    factory="zope.app.traversing.adapters.RootPhysicallyLocatable" />
 
 <traversalNamespace
     name="etc"
-    handler="zope.app.traversing.namespace.etc"
-    />
+    handler="zope.app.traversing.namespace.etc" />
+
 <traversalNamespace
     name="view"
-    handler="zope.app.traversing.namespace.view"
-    />
+    handler="zope.app.traversing.namespace.view" />
+
 <traversalNamespace
     name="resource"
-    handler="zope.app.traversing.namespace.resource"
-    />
+    handler="zope.app.traversing.namespace.resource" />
+
 <traversalNamespace
     name="attribute"
-    handler="zope.app.traversing.namespace.attr"
-    />
+    handler="zope.app.traversing.namespace.attr" />
+
 <traversalNamespace
     name="item"
-    handler="zope.app.traversing.namespace.item"
-    />
+    handler="zope.app.traversing.namespace.item" />
+
 <traversalNamespace
     name="acquire"
-    handler="zope.app.traversing.namespace.acquire"
-    />
+    handler="zope.app.traversing.namespace.acquire" />
+
 <traversalNamespace
     name="skin"
-    handler="zope.app.traversing.namespace.skin"
-    />
+    handler="zope.app.traversing.namespace.skin" />
+
 <traversalNamespace
     name="help"
-    handler="zope.app.traversing.namespace.help"
-    />
+    handler="zope.app.traversing.namespace.help" />
+
 <traversalNamespace
     name="vh"
-    handler="zope.app.traversing.namespace.vh"
-    />
-</zopeConfigure>
+    handler="zope.app.traversing.namespace.vh" />
+
+</configure>


=== Zope3/src/zope/app/traversing/meta.zcml 1.3 => 1.4 ===
--- Zope3/src/zope/app/traversing/meta.zcml:1.3	Sat Dec 28 12:49:33 2002
+++ Zope3/src/zope/app/traversing/meta.zcml	Sat Aug  2 14:17:25 2003
@@ -1,10 +1,11 @@
-<zopeConfigure xmlns='http://namespaces.zope.org/zope'>
+<configure 
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:meta="http://namespaces.zope.org/meta">
 
-  <directives namespace="http://namespaces.zope.org/zope">
+    <meta:directive 
+       name="traversalNamespace" 
+       namespace="http://namespaces.zope.org/zope"
+       schema=".metadirectives.ITraversalNamespaceDirective"
+       handler=".metaconfigure.traversalNamespace" />
 
-    <directive name="traversalNamespace" attributes="name handler"
-       handler="zope.app.traversing.namespace.directive" />
-
-  </directives>
-
-</zopeConfigure>
+</configure>


=== Zope3/src/zope/app/traversing/namespace.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/traversing/namespace.py:1.15	Fri Jul  4 06:59:24 2003
+++ Zope3/src/zope/app/traversing/namespace.py	Sat Aug  2 14:17:25 2003
@@ -43,14 +43,6 @@
 def provideNamespaceHandler(ns, handler):
     _namespace_handlers[ns] = handler
 
-def directive(_context, name, handler):
-    handler = _context.resolve(handler)
-    return [Action(
-               discriminator=("traversalNamespace", name),
-               callable=provideNamespaceHandler,
-               args=(name, handler),
-               )]
-
 def namespaceLookup(name, ns, qname, parameters, object, request=None):
     """Lookup a value from a namespace