[Zope3-checkins] CVS: Zope3/src/zope/app/onlinehelp - metadirectives.py:1.1 __init__.py:1.11 configure.zcml:1.5 meta.zcml:1.2 metaconfigure.py:1.5
Stephan Richter
srichter@cosmos.phy.tufts.edu
Sat, 2 Aug 2003 07:19:57 -0400
Update of /cvs-repository/Zope3/src/zope/app/onlinehelp
In directory cvs.zope.org:/tmp/cvs-serv12413
Modified Files:
__init__.py configure.zcml meta.zcml metaconfigure.py
Added Files:
metadirectives.py
Log Message:
Converted 'help' ZCML namespace to new style. All tests and ftests pass.
=== Added File Zope3/src/zope/app/onlinehelp/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.
#
##############################################################################
"""Schemas for the 'help' ZCML namespace
$Id: metadirectives.py,v 1.1 2003/08/02 11:19:21 srichter Exp $
"""
from zope.configuration.fields import GlobalObject, Path
from zope.interface import Interface, implements, classProvides
from zope.schema import TextLine, BytesLine
class IRegisterDirective(Interface):
"""Register directive for onlien help topics."""
id = BytesLine(
title=u"Topic Id",
description=u"Id of the topic as it will appear in the URL.",
required=True)
title = TextLine(
title=u"Title",
description=u"Provides a title for the online Help Topic.",
required=True)
parent = BytesLine(
title=u"Parent Topic",
description=u"Id of the parent topic.",
default="",
required=False)
for_ = GlobalObject(
title=u"Object Interface",
description=u"Interface for which this Help Topic is registered.",
default=None,
required=False)
view = BytesLine(
title=u"View Name",
description=u"The view name for which this Help Topic is registered.",
default="",
required=False)
doc_path = Path(
title=u"Path to File",
description=u"Path to the fiel that contains the Help Topic content.",
required=True)
=== Zope3/src/zope/app/onlinehelp/__init__.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/onlinehelp/__init__.py:1.10 Tue Jul 15 10:20:12 2003
+++ Zope3/src/zope/app/onlinehelp/__init__.py Sat Aug 2 07:19:21 2003
@@ -96,17 +96,6 @@
self._registry[(interface, view)] = []
self._registry[(interface, view)].append(topic)
- def unregisterHelpTopic(self, topic_path):
- "See Zope.App.OnlineHelp.interfaces.IOnlineHelp"
- # Delete topic from tree
- topic = traverse(self, topic_path)
- name = getName(topic)
- parent = getParent(topic)
- del parent[name]
- # unregister from registry
- for item in self._registry.items():
- if topic in item[1]:
- item[1].remove(topic)
# Global Online Help
path = os.path.join(os.path.dirname(zope.app.__file__),
=== Zope3/src/zope/app/onlinehelp/configure.zcml 1.4 => 1.5 ===
--- Zope3/src/zope/app/onlinehelp/configure.zcml:1.4 Tue Jul 1 21:27:59 2003
+++ Zope3/src/zope/app/onlinehelp/configure.zcml Sat Aug 2 07:19:21 2003
@@ -1,39 +1,36 @@
-<zopeConfigure
+<configure
xmlns="http://namespaces.zope.org/zope"
- xmlns:service="http://namespaces.zope.org/service"
- xmlns:help="http://namespaces.zope.org/help"
- >
+ xmlns:help="http://namespaces.zope.org/help">
<content class="zope.app.onlinehelp.OnlineHelpTopic">
<require
permission="zope.View"
- interface="zope.app.interfaces.onlinehelp.IOnlineHelpTopic"
- />
+ interface="zope.app.interfaces.onlinehelp.IOnlineHelpTopic" />
</content>
-<!-- Setup OnlineHelp as Service -->
-<serviceType id="OnlineHelp"
- interface="zope.app.interfaces.onlinehelp.IOnlineHelp" />
-
-<service serviceType="OnlineHelp"
- permission="zope.Public"
- component="zope.app.onlinehelp.help" />
-
-<!-- Register initial Help Topics -->
-<help:register
- id = "ui"
- title = "Zope UI Help"
- doc_path = "./ui.txt" />
-
-<help:register
- id = "welcome"
- title = "Welcome"
- parent = "ui"
- doc_path = "./help.txt" />
-
-<help:register
- id = "onlinehelp"
- title = "Online help system"
- doc_path = "./README.txt" />
+ <!-- Setup OnlineHelp as Service -->
+ <serviceType id="OnlineHelp"
+ interface="zope.app.interfaces.onlinehelp.IOnlineHelp" />
+
+ <service serviceType="OnlineHelp"
+ permission="zope.Public"
+ component="zope.app.onlinehelp.help" />
+
+ <!-- Register initial Help Topics -->
+ <help:register
+ id = "ui"
+ title = "Zope UI Help"
+ doc_path = "./ui.txt" />
+
+ <help:register
+ id = "welcome"
+ title = "Welcome"
+ parent = "ui"
+ doc_path = "./help.txt" />
+
+ <help:register
+ id = "onlinehelp"
+ title = "Online help system"
+ doc_path = "./README.txt" />
-</zopeConfigure>
+</configure>
=== Zope3/src/zope/app/onlinehelp/meta.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/onlinehelp/meta.zcml:1.1 Tue Jan 7 07:27:49 2003
+++ Zope3/src/zope/app/onlinehelp/meta.zcml Sat Aug 2 07:19:21 2003
@@ -1,13 +1,11 @@
-<zopeConfigure xmlns="http://namespaces.zope.org/zope">
- <directives namespace="http://namespaces.zope.org/help">
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:meta="http://namespaces.zope.org/meta">
- <directive name="register"
- attributes="parent id title doc_path doc_type for view"
- handler="zope.app.onlinehelp.metaconfigure.register" />
+ <meta:directive
+ namespace="http://namespaces.zope.org/help"
+ name="register"
+ schema=".metadirectives.IRegisterDirective"
+ handler=".metaconfigure.register" />
- <directive name="unregister"
- attributes="path"
- handler="zope.app.onlinehelp.metaconfigure.unregister" />
-
- </directives>
-</zopeConfigure>
+</configure>
=== Zope3/src/zope/app/onlinehelp/metaconfigure.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/onlinehelp/metaconfigure.py:1.4 Tue Jul 15 10:46:07 2003
+++ Zope3/src/zope/app/onlinehelp/metaconfigure.py Sat Aug 2 07:19:21 2003
@@ -21,28 +21,15 @@
import os
from zope.app.onlinehelp import help
from zope.app.component.metaconfigure import resolveInterface
-from zope.configuration.action import Action
-def register(_context, id, title, parent="", doc_path=None, doc_type="txt",
- for_=None, view=None):
+def register(_context, id, title, parent="", doc_path=None, for_=None,
+ view=None):
"""Register an OnlineHelp topic"""
- actions = []
- doc_path = _context.path(doc_path)
- doc_path = os.path.normpath(doc_path)
- if for_ is not None:
- for_ = resolveInterface(_context, for_)
+ # XXX This should be really autodetected.
+ doc_type="txt"
- return [
- Action(discriminator = ('registerHelpTopic', parent, id),
- callable = help.registerHelpTopic,
- args = (parent, id, title, doc_path, doc_type, for_, view) )
- ]
-
-
-def unregister(_context, path):
- return [
- Action(discriminator = ('unregisterHelpTopic', path),
- callable = help.unregisterHelpTopic,
- args = (path,) )
- ]
+ _context.action(
+ discriminator = ('registerHelpTopic', parent, id),
+ callable = help.registerHelpTopic,
+ args = (parent, id, title, doc_path, doc_type, for_, view) )