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

Philipp von Weitershausen philikon at philikon.de
Sun Aug 3 18:22:35 EDT 2003


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

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/applicationcontrol/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.
#
##############################################################################
"""Register ServerControl configuration directives.

$Id: metadirectives.py,v 1.1 2003/08/03 21:22:29 philikon Exp $
"""

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

class IRegisterShutdownHookDirective(Interface):
    """
    Register a shutdown hook
    """

    call = GlobalObject(
        title=u"Callable",
        description=u"""
        Callable that takes no arguments and invokes the shutdown""",
        required=True
        )

    priority = Float(
        title=u"Priority",
        required=True
        )

    name = TextLine(
        title=u"Name",
        required=False
        )


=== Zope3/src/zope/app/applicationcontrol/meta.zcml 1.3 => 1.4 ===
--- Zope3/src/zope/app/applicationcontrol/meta.zcml:1.3	Thu Jul 31 17:37:18 2003
+++ Zope3/src/zope/app/applicationcontrol/meta.zcml	Sun Aug  3 17:22:29 2003
@@ -1,11 +1,16 @@
-<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/server-control">
-    <directive 
+  <meta:directives namespace="http://namespaces.zope.org/server-control">
+
+    <meta:directive 
         name="registerShutdownHook"
-        attributes="call priority name"
-        handler="zope.app.applicationcontrol.metaconfigure.registerShutdownHook"
-    />
-  </directives>
+        schema=".metadirectives.IRegisterShutdownHookDirective"
+        handler=".metaconfigure.registerShutdownHook"
+        />
+
+  </meta:directives>
 
-</zopeConfigure>
+</configure>


=== Zope3/src/zope/app/applicationcontrol/metaconfigure.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/applicationcontrol/metaconfigure.py:1.3	Thu Jul 31 17:37:18 2003
+++ Zope3/src/zope/app/applicationcontrol/metaconfigure.py	Sun Aug  3 17:22:29 2003
@@ -20,17 +20,14 @@
 from zope.app.interfaces.applicationcontrol import IServerControl
 from zope.configuration.action import Action
 
-
 def registerShutdownHook(_context, call, name, priority):
     """Register a shutdown hook with the current server control utility"""
-    return [
-        Action(
-            discriminator = ('server-control:registerShutdownHook', name),
-            callable = doRegisterShutdownHook,
-            args = (_context, call, priority, name),
-            )
-        ]
+    _context.action(
+        discriminator = ('server-control:registerShutdownHook', name),
+        callable = doRegisterShutdownHook,
+        args = (_context, call, priority, name)
+        )
 
 def doRegisterShutdownHook(_context, call, priority, name):
     server_control = getUtility(_context, IServerControl)
-    server_control.registerShutdownHook(_context.resolve(call), priority, name)
+    server_control.registerShutdownHook(call, priority, name)




More information about the Zope3-Checkins mailing list