[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/ApplicationControl - application-control-meta.zcml:1.1.2.1 metaConfigure.py:1.1.2.1 ApplicationControl.py:1.1.2.5 IApplicationControl.py:1.1.2.4

Philipp von Weitershausen philikon@gmx.net
Wed, 10 Apr 2002 07:19:31 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/ApplicationControl
In directory cvs.zope.org:/tmp/cvs-serv5379/App/OFS/ApplicationControl

Modified Files:
      Tag: Zope-3x-branch
	ApplicationControl.py IApplicationControl.py 
Added Files:
      Tag: Zope-3x-branch
	application-control-meta.zcml metaConfigure.py 
Log Message:
Made ApplicationControl pluggable; plugins are views for the
ApplicationController instance


=== Added File Zope3/lib/python/Zope/App/OFS/ApplicationControl/application-control-meta.zcml ===
<zopeConfigure xmlns='http://namespaces.zope.org/zope'>

  <!-- Zope.App.OFS.ApplicationControl -->
  <directives namespace="http://namespaces.zope.org/application-control">
    <directive name="registerView"
               attributes="name, title"
               handler="Zope.App.OFS.ApplicationControl.metaConfigure.registerView" />
  </directives>

</zopeConfigure>


=== Added File Zope3/lib/python/Zope/App/OFS/ApplicationControl/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.
# 
##############################################################################
""" Register Application Control configuration directives.

$Id: metaConfigure.py,v 1.1.2.1 2002/04/10 11:18:59 philikon Exp $
"""

from ApplicationControl import ApplicationController
from Zope.Configuration.Action import Action


def registerView(_context, name, title):
    return [
        Action(
            discriminator = ('application-control:registerView', name),
            callable = ApplicationController.registerView,
            args = (name, title),
            )
        ]



=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ApplicationControl.py 1.1.2.4 => 1.1.2.5 ===
     def __init__(self):
         self.start_time = time.time()
+        self._views = []
 
     ############################################################
     # Implementation methods for interface
@@ -34,6 +35,14 @@
     def getStartTime(self):
         'See Zope.App.OFS.ApplicationControl.IApplicationControl.IApplicationControl'
         return self.start_time
+
+    def registerView(self, name, title):
+        'See Zope.App.OFS.ApplicationControl.IApplicationControl.IApplicationControl'
+        self._views.append({'name': name, 'title': title})
+
+    def getListOfViews(self):
+        'See Zope.App.OFS.ApplicationControl.IApplicationControl.IApplicationControl'
+        return tuple(self._views)
 
     #
     ############################################################


=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/IApplicationControl.py 1.1.2.3 => 1.1.2.4 ===
         """Return the time when the ApplicationControl object has been instanciated
            in seconds since the epoch"""
+
+    def registerView(name, title):
+        """Register a view called <name> to be displayed in ApplicationControl
+        """
+
+    def getListOfViews():
+        """Return a sequence containing dictionaries with the registered views' names
+        and titles mapped with the keys 'name' and 'title'"""