[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate - metadirectives.py:1.1 meta.zcml:1.2 metaconfigure.py:1.2

Philipp von Weitershausen philikon at philikon.de
Sun Aug 3 17:43:40 EDT 2003


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

Modified Files:
	meta.zcml metaconfigure.py 
Added Files:
	metadirectives.py 
Log Message:
Converted yet another set of ZCML directives.


=== Added File Zope3/src/zope/app/pagetemplate/metadirectives.py ===
##############################################################################
#
# Copyright (c) 2003 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.
#
##############################################################################
"""ZCML configuration directives for configuring the default zope:
namespace in TALES.

$Id: metadirectives.py,v 1.1 2003/08/03 20:43:35 philikon Exp $
"""

from zope.interface import Interface
from zope.configuration.fields import GlobalObject
from zope.schema import TextLine

class INamespaceDirective(Interface):
    """
    Define a new tales namespace
     
    A namespace is defined by providing a prefix and an interface. A
    handler for the namespace will be obtained by looking up an
    adapter for the given interface.
    """

    prefix = TextLine(
        title=u"The prefix used in tales expressions.",
        description=u"""
        For example, if the prefix is "dc", then a tales expression
        would look like: ``foo/bar/dc:title``.""",
        required=True
        )

    interface = GlobalObject(
        title=u"The namespace interface",
        description=u"""
        This is an interface that the namespace must provide.  we'll
        get the namespace by getting an adapter for this
        interface.""",
        required=True
        )


=== Zope3/src/zope/app/pagetemplate/meta.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/pagetemplate/meta.zcml:1.1	Tue Apr 15 14:52:57 2003
+++ Zope3/src/zope/app/pagetemplate/meta.zcml	Sun Aug  3 16:43:35 2003
@@ -1,33 +1,15 @@
-<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/tales">
+  <meta:directives namespace="http://namespaces.zope.org/tales">
 
-    <directive name="namespace" handler=".metaconfigure.namespace" >
-       <description>Define a new tales namespace
-     
-       A namespace is defined by providing a prefix and an interface. A
-       handler for the namespace will be obtained by looking up an adapter for the
-       given interface.
-       </description>
+    <meta:directive name="namespace"
+        schema=".metadirectives.INamespaceDirective"
+        handler=".metaconfigure.namespace"
+        />
 
-       <attribute name="prefix" required="yes">
-         <description>The prefix used in tales expressions. 
+  </meta:directives>
 
-         For example, if the prefix is "dc", then a tales expression would
-         look like: ``foo/bar/dc:title``.
-         </description>
-       </attribute>
-
-       <attribute name="interface" required="yes">
-         <description>The namespace interface
-
-         This is an interface that the namespace must provide.
-         we'll get the namespace by getting an adapter for this interface.
-         </description>
-       </attribute>
-
-    </directive>
-
-  </directives>
-
-</zopeConfigure>
+</configure>


=== Zope3/src/zope/app/pagetemplate/metaconfigure.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/pagetemplate/metaconfigure.py:1.1	Tue Apr 15 14:52:57 2003
+++ Zope3/src/zope/app/pagetemplate/metaconfigure.py	Sun Aug  3 16:43:35 2003
@@ -11,23 +11,22 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""ZCML configuration directives for configuring the default zope: namespace in TALES.
+"""ZCML configuration directives for configuring the default zope:
+namespace in TALES.
 
 $Id$
 """
 
 from zope.app.pagetemplate.engine import Engine
 from zope.configuration.action import Action
-from zope.app.component.metaconfigure import resolveInterface
 from zope.testing.cleanup import addCleanUp
 from zope.component import getAdapter
 
 def namespace(_context, prefix, interface):
-    interface = resolveInterface(_context, interface)
-    return [Action(
+    _context.action(
         discriminator = ("tales:namespace", prefix),
         callable = Engine.registerFunctionNamespace,
         args = (prefix, lambda ob: getAdapter(ob, interface)),
-        )]
+        )
 
 addCleanUp(Engine.namespaces.clear)




More information about the Zope3-Checkins mailing list