[Zope3-checkins] SVN: Zope3/trunk/ - API doctool has received some
upgrades:
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Feb 17 17:38:56 EST 2005
Log message for revision 29199:
- API doctool has received some upgrades:
* A new `bookmodule` compiles all our README.txt and other text
documentation files to a nice book-like format.
* A new `typemodule` lists all interface types (such as
`IContentType`) and then let's you see all interfaces providing this
type (for example `IFile`)
Changed:
U Zope3/trunk/doc/CHANGES.txt
A Zope3/trunk/src/zope/app/apidoc/bookmodule/
A Zope3/trunk/src/zope/app/apidoc/bookmodule/__init__.py
A Zope3/trunk/src/zope/app/apidoc/bookmodule/book.py
A Zope3/trunk/src/zope/app/apidoc/bookmodule/book.zcml
A Zope3/trunk/src/zope/app/apidoc/bookmodule/browser.py
A Zope3/trunk/src/zope/app/apidoc/bookmodule/chapter.pt
A Zope3/trunk/src/zope/app/apidoc/bookmodule/configure.zcml
A Zope3/trunk/src/zope/app/apidoc/bookmodule/empty.txt
A Zope3/trunk/src/zope/app/apidoc/bookmodule/intro.txt
A Zope3/trunk/src/zope/app/apidoc/bookmodule/menu.pt
A Zope3/trunk/src/zope/app/apidoc/bookmodule/meta.zcml
A Zope3/trunk/src/zope/app/apidoc/bookmodule/metaconfigure.py
A Zope3/trunk/src/zope/app/apidoc/bookmodule/metadirectives.py
A Zope3/trunk/src/zope/app/apidoc/bookmodule/tests.py
U Zope3/trunk/src/zope/app/apidoc/browser/contents.pt
U Zope3/trunk/src/zope/app/apidoc/browser/modules.pt
U Zope3/trunk/src/zope/app/apidoc/configure.zcml
U Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py
U Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.pt
A Zope3/trunk/src/zope/app/apidoc/typemodule/
A Zope3/trunk/src/zope/app/apidoc/typemodule/__init__.py
A Zope3/trunk/src/zope/app/apidoc/typemodule/browser.py
A Zope3/trunk/src/zope/app/apidoc/typemodule/configure.zcml
A Zope3/trunk/src/zope/app/apidoc/typemodule/menu.pt
A Zope3/trunk/src/zope/app/apidoc/typemodule/tests.py
A Zope3/trunk/src/zope/app/apidoc/typemodule/type.py
U Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/doc/CHANGES.txt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -10,6 +10,15 @@
New features
+ - API doctool has received some upgrades:
+
+ * A new `bookmodule` compiles all our README.txt and other text
+ documentation files to a nice book-like format.
+
+ * A new `typemodule` lists all interface types (such as
+ `IContentType`) and then let's you see all interfaces providing this
+ type (for example `IFile`)
+
- Zope 3 can now listen on specified network interfaces only. Example
of a server section in zope.conf:
@@ -396,6 +405,11 @@
Bug Fixes
+ - When I converted layers and skins to interfaces, I got the layer part
+ wrong and made layer interfaces extend `ILayer`. But `ILayer` is an
+ `IInterface`, *not* an Interface. Layers should not extend but provide
+ `ILayer`.
+
- Fixed most formatting characters for i18n's datetime formatter. Only
timezones are left.
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/__init__.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/__init__.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1 @@
+# Make a package
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/book.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/book.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/book.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,64 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Interface Documentation Module
+
+The interface documentation module retrieves its information from the
+site manager. Therefore, currently there are no unregsitered interfaces
+listed in the documentation. This might be good, since unregistered interfaces
+are usually private and not of interest to a general developer.
+
+$Id: __init__.py 29143 2005-02-14 22:43:16Z srichter $
+"""
+__docformat__ = 'restructuredtext'
+import os.path
+
+import zope.app.apidoc.bookmodule
+from zope.app import zapi
+from zope.interface import implements
+from zope.app.apidoc.interfaces import IDocumentationModule
+from zope.app.i18n import ZopeMessageIDFactory as _
+
+from zope.app.onlinehelp.onlinehelp import OnlineHelp
+
+
+class IBookModule(IDocumentationModule):
+ """Interface API Documentation Module
+
+ This is a marker interface, so that we can write adapters for objects
+ implementing this interface.
+ """
+
+class BookModule(OnlineHelp):
+ """Represent a book compiled from various README.txt and other *.txt
+ documentation files.
+ """
+
+ implements(IBookModule)
+
+ # See zope.app.apidoc.interfaces.IDocumentationModule
+ title = _('Book')
+
+ # See zope.app.apidoc.interfaces.IDocumentationModule
+ description = _("""
+ This is a developer's book compiled from all existing documentation
+ files. It is not meant to be a complete or cohesive work, but each chapter
+ in itself is a little story. Think about it like a collection of fairy
+ tales.
+ """)
+
+
+# Global Book Instance
+path = os.path.join(os.path.dirname(zope.app.apidoc.bookmodule.__file__),
+ 'intro.txt')
+book = BookModule('Book', path)
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/book.zcml
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/book.zcml 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/book.zcml 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,465 @@
+<configure
+ xmlns="http://namespaces.zope.org/apidoc">
+
+ <!-- Interfaces -->
+ <bookchapter
+ id="ifaceschema"
+ title="Interfaces and Schemas"
+ />
+ <configure package="zope.interface">
+ <bookchapter
+ id="interface"
+ title="Interfaces"
+ doc_path="README.txt"
+ parent="ifaceschema"
+ />
+ <bookchapter
+ id="adapter"
+ title="Adapter Registry"
+ doc_path="adapter.txt"
+ parent="ifaceschema"
+ />
+ <bookchapter
+ id="human"
+ title="Adapters (light version)"
+ doc_path="human.txt"
+ parent="ifaceschema"
+ />
+ <bookchapter
+ id="foodforthought"
+ title="Food For Thought"
+ doc_path="tests/foodforthought.txt"
+ parent="ifaceschema"
+ />
+ </configure>
+ <configure package="zope.schema">
+ <bookchapter
+ id="schemas"
+ title="Schemas"
+ doc_path="README.txt"
+ parent="ifaceschema"
+ />
+ <bookchapter
+ id="fields"
+ title="Schema Fields"
+ doc_path="fields.txt"
+ parent="ifaceschema"
+ />
+ </configure>
+
+ <!-- Component Architecture -->
+ <bookchapter
+ id="ca"
+ title="Component Architecture"
+ />
+ <configure package="zope.component">
+ <bookchapter
+ id="global"
+ title="Global Component Architecture"
+ parent="ca"
+ doc_path="README.txt"
+ />
+ <bookchapter
+ id="socket"
+ title="Global CA (Socket Example)"
+ parent="ca"
+ doc_path="socketexample.txt"
+ />
+ <bookchapter
+ id="factory"
+ title="Factories"
+ parent="ca"
+ doc_path="factory.txt"
+ />
+ </configure>
+
+ <configure package="zope.app.component">
+ <bookchapter
+ id="local"
+ title="Local Component Architecture"
+ parent="ca"
+ doc_path="README.txt"
+ />
+ <bookchapter
+ id="registration"
+ title="Registration Framework"
+ parent="ca/local"
+ doc_path="registration.txt"
+ />
+ <bookchapter
+ id="adapterregistry"
+ title="Local Adapter Registry"
+ parent="ca/local"
+ doc_path="adapterregistry.txt"
+ />
+ <bookchapter
+ id="site"
+ title="Local Sites & Site Managers"
+ parent="ca/local"
+ doc_path="site.txt"
+ />
+ </configure>
+
+ <!-- Security -->
+ <configure package="zope.security">
+ <bookchapter
+ id="security"
+ title="Security"
+ doc_path="README.txt"
+ />
+ <bookchapter
+ id="untrusted"
+ title="Untrusted Interpreters"
+ doc_path="untrustedinterpreter.txt"
+ parent="security"
+ />
+ <bookchapter
+ id="interpreter"
+ title="Untrusted Python Interpreter"
+ doc_path="untrustedpython/interpreter.txt"
+ parent="security/untrusted"
+ />
+ <bookchapter
+ id="rcompile"
+ title="Restricted Python Code"
+ doc_path="untrustedpython/rcompile.txt"
+ parent="security/untrusted"
+ />
+ <bookchapter
+ id="builtins"
+ title="Safe Builtins"
+ doc_path="untrustedpython/builtins.txt"
+ parent="security/untrusted"
+ />
+ </configure>
+ <configure package="zope.app.securitypolicy">
+ <bookchapter
+ id="zopepolicy"
+ title="Default Security Policy"
+ doc_path="zopepolicy.txt"
+ parent="security"
+ />
+ </configure>
+ <configure package="zope.app.security">
+ <bookchapter
+ id="globalprincipals"
+ title="Global Principals"
+ doc_path="globalprincipals.txt"
+ parent="security"
+ />
+ </configure>
+ <configure package="zope.app.authentication">
+ <bookchapter
+ id="authentication"
+ title="Pluggable Authentication"
+ doc_path="README.txt"
+ parent="security"
+ />
+ <bookchapter
+ id="idpicker"
+ title="Id Picker"
+ doc_path="idpicker.txt"
+ parent="security/authentication"
+ />
+ <bookchapter
+ id="principalfolder"
+ title="Principal Folder"
+ doc_path="principalfolder.txt"
+ parent="security/authentication"
+ />
+ <bookchapter
+ id="groupfolder"
+ title="Group Folders"
+ doc_path="groupfolder.txt"
+ parent="security/authentication"
+ />
+ </configure>
+ <configure package="zope.app.homefolder">
+ <bookchapter
+ id="homefolder"
+ title="Principal Home Folder"
+ doc_path="README.txt"
+ parent="security"
+ />
+ </configure>
+
+ <!-- Events -->
+ <configure package="zope.event">
+ <bookchapter
+ id="event"
+ title="Events"
+ doc_path="README.txt"
+ />
+ </configure>
+
+ <!-- Testing -->
+ <bookchapter
+ id="test"
+ title="Testing"
+ />
+ <configure package="zope.app.ftests">
+ <bookchapter
+ id="fdoctest"
+ title="Functional DocTest"
+ doc_path="doctest.txt"
+ parent="test"
+ />
+ </configure>
+ <configure package="zope.app.testing">
+ <bookchapter
+ id="fdoctest-howto"
+ title="FDocTest (How to)"
+ doc_path="dochttp.txt"
+ parent="test"
+ />
+ </configure>
+ <configure package="zope.testing">
+ <bookchapter
+ id="formparser"
+ title="Form Parse"
+ doc_path="formparser.txt"
+ parent="test"
+ />
+ </configure>
+
+ <!-- ZAPI -->
+ <configure package="zope.app.zapi">
+ <bookchapter
+ id="zapi"
+ title="ZAPI"
+ doc_path="README.txt"
+ />
+ </configure>
+
+ <!-- Widgets and Forms -->
+ <bookchapter
+ id="form"
+ title="Widgets and Forms"
+ />
+ <configure package="zope.app.form.browser">
+ <bookchapter
+ id="bwidget"
+ title="Basic Widgets"
+ doc_path="README.txt"
+ parent="form"
+ />
+ <bookchapter
+ id="swidget"
+ title="Source Widgets"
+ doc_path="source.txt"
+ parent="form"
+ />
+ <bookchapter
+ id="awidget"
+ title="Advanced Widgets"
+ doc_path="widgets.txt"
+ parent="form"
+ />
+ </configure>
+
+ <!-- Workflow -->
+ <configure package="zope.wfmc">
+ <bookchapter
+ id="wfmc"
+ title="WfMC Workflows"
+ doc_path="README.txt"
+ />
+ <bookchapter
+ id="xpdl"
+ title="Workflows using XPDL"
+ doc_path="README.txt"
+ parent="wfmc"
+ />
+ </configure>
+ <configure package="zope.app.wfmc">
+ <bookchapter
+ id="zcml"
+ title="Registering XPDL using ZCML"
+ doc_path="zcml.txt"
+ parent="wfmc"
+ />
+ </configure>
+
+ <!-- Indexes and Catalogs -->
+ <bookchapter
+ id="indexcatalog"
+ title="Indexes and Catalogs"
+ />
+ <configure package="zope.index">
+ <bookchapter
+ id="fieldindex"
+ title="Field Indexes"
+ doc_path="field/README.txt"
+ parent="indexcatalog"
+ />
+ <bookchapter
+ id="testindex"
+ title="Text Indexes"
+ doc_path="text/textindex.txt"
+ parent="indexcatalog"
+ />
+ </configure>
+ <configure package="zope.app.catalog">
+ <bookchapter
+ id="catalog"
+ title="Catalog"
+ doc_path="README.txt"
+ parent="indexcatalog"
+ />
+ </configure>
+
+ <!-- Sessions -->
+ <configure package="zope.app.session">
+ <bookchapter
+ id="session"
+ title="Sessions"
+ doc_path="design.txt"
+ />
+ <bookchapter
+ id="api"
+ title="API"
+ doc_path="api.txt"
+ parent="session"
+ />
+ </configure>
+
+ <!-- Cached Properties -->
+ <bookchapter
+ id="i18nl10n"
+ title="I18n and L10n"
+ />
+ <configure package="zope.i18nmessageid">
+ <bookchapter
+ id="messageid"
+ title="Message Ids"
+ doc_path="messages.txt"
+ parent="i18nl10n"
+ />
+ </configure>
+
+ <!-- Cached Properties -->
+ <configure package="zope.cachedescriptors">
+ <bookchapter
+ id="cachedprops"
+ title="Cached Properties"
+ doc_path="property.txt"
+ />
+ </configure>
+
+ <!-- Generations -->
+ <configure package="zope.app.generations">
+ <bookchapter
+ id="generations"
+ title="Generations"
+ doc_path="README.txt"
+ />
+ </configure>
+
+ <!-- Locking -->
+ <configure package="zope.app.locking">
+ <bookchapter
+ id="locking"
+ title="Object Locking"
+ doc_path="README.txt"
+ />
+ </configure>
+
+ <!-- Version Control -->
+ <configure package="zope.app.versioncontrol">
+ <bookchapter
+ id="versioncontrol"
+ title="Version Control"
+ doc_path="README.txt"
+ />
+ </configure>
+
+ <!-- Persistent Modules -->
+ <configure package="zope.app.module">
+ <bookchapter
+ id="module"
+ title="Persistent Modules"
+ doc_path="README.txt"
+ />
+ </configure>
+
+ <!-- Zope Tree -->
+ <configure package="zope.app.generations">
+ <bookchapter
+ id="tree"
+ title="Zope Tree"
+ doc_path="README.txt"
+ />
+ </configure>
+
+ <!-- Persistent Key References -->
+ <configure package="zope.app.keyreference">
+ <bookchapter
+ id="keyref"
+ title="Persistent Key References"
+ doc_path="persistent.txt"
+ />
+ </configure>
+
+ <!-- BForest -->
+ <configure package="zope.bforest">
+ <bookchapter
+ id="bforest"
+ title="BForest API"
+ doc_path="bforest.txt"
+ />
+ </configure>
+
+ <!-- Deprecation API -->
+ <configure package="zope.deprecation">
+ <bookchapter
+ id="deprecation"
+ title="Deprecation API"
+ doc_path="README.txt"
+ />
+ </configure>
+
+ <!-- Persistence -->
+ <configure package="persistent.tests">
+ <bookchapter
+ id="persistent"
+ title="Persistent Framework"
+ doc_path="persistent.txt"
+ />
+ </configure>
+
+ <!-- Transactions -->
+ <configure package="transaction">
+ <bookchapter
+ id="transaction"
+ title="Transaction API"
+ doc_path="notes.txt"
+ />
+ </configure>
+
+ <!-- ZODB -->
+ <configure package="ZODB">
+ <bookchapter
+ id="zodb"
+ title="Zope Object Database (ZODB)"
+ />
+ <bookchapter
+ id="dbopen"
+ title="Connection Management"
+ parent="zodb"
+ doc_path="tests/dbopen.txt"
+ />
+ <bookchapter
+ id="subtransactions"
+ title="Sub-Transactions"
+ parent="zodb"
+ doc_path="subtransactions.txt"
+ />
+ <bookchapter
+ id="collaborations"
+ title="Collaborations"
+ parent="zodb"
+ doc_path="collaborations.txt"
+ />
+ </configure>
+
+</configure>
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/browser.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/browser.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,56 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Browser Views for Book
+
+$Id: browser.py 28451 2004-11-13 23:21:47Z shane $
+"""
+__docformat__ = 'restructuredtext'
+from metaconfigure import EMPTYPATH
+
+class Menu(object):
+ """Menu View Helper Class
+
+ >>> class Chapter(object):
+ ... title = 'Read Me'
+ ... path = 'README.txt'
+ ...
+ ... def getTopicPath(self):
+ ... return self.path[:-4]
+
+ >>> class Node(object):
+ ... def __init__(self, context):
+ ... self.context = context
+
+ >>> menu = Menu()
+
+ >>> chapter = Chapter()
+ >>> node = Node(chapter)
+ >>> menu.getMenuTitle(node)
+ 'Read Me'
+
+ >>> menu.getMenuLink(node)
+ 'README/show.html'
+ >>> chapter.path = EMPTYPATH
+ >>> menu.getMenuLink(node)
+ """
+
+ def getMenuTitle(self, node):
+ """Return the title of the node that is displayed in the menu."""
+ return node.context.title
+
+ def getMenuLink(self, node):
+ """Return the HTML link of the node that is displayed in the menu."""
+ if node.context.path == EMPTYPATH:
+ return None
+ return node.context.getTopicPath() + '/show.html'
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/chapter.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/chapter.pt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/chapter.pt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,7 @@
+<html metal:use-macro="views/apidoc_macros/details">
+<body metal:fill-slot="contents">
+
+ <div tal:content="structure view/topicContent" />
+
+</body>
+</html>
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/configure.zcml 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/configure.zcml 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,38 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:apidoc="http://namespaces.zope.org/apidoc">
+
+ <class class=".book.BookModule">
+ <allow interface=".book.IBookModule" />
+ <allow interface="zope.app.container.interfaces.IReadContainer" />
+ </class>
+
+ <!-- Register the module with the API Documentation System -->
+
+ <utility
+ provides="zope.app.apidoc.interfaces.IDocumentationModule"
+ component=".book.book"
+ name="Book" />
+
+ <!-- Book Documentation Module Menu -->
+
+ <browser:page
+ for=".book.IBookModule"
+ permission="zope.app.apidoc.UseAPIDoc"
+ class=".browser.Menu"
+ name="menu.html"
+ template="menu.pt"
+ />
+
+ <browser:page
+ for="zope.app.onlinehelp.interfaces.IOnlineHelpTopic"
+ permission="zope.app.apidoc.UseAPIDoc"
+ class="zope.app.onlinehelp.browser.OnlineHelpTopicView"
+ name="show.html"
+ template="chapter.pt"
+ />
+
+ <include file="book.zcml" />
+
+</configure>
\ No newline at end of file
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/empty.txt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/empty.txt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/empty.txt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1 @@
+
\ No newline at end of file
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/intro.txt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/intro.txt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/intro.txt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,2 @@
+This book has been compiled from various documentation files in the Zope 3
+source code.
\ No newline at end of file
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/menu.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/menu.pt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/menu.pt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,5 @@
+<html metal:use-macro="views/apidoc_macros/menu">
+<body>
+
+</body>
+</html>
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/meta.zcml
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/meta.zcml 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/meta.zcml 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,11 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:meta="http://namespaces.zope.org/meta">
+
+ <meta:directive
+ namespace="http://namespaces.zope.org/apidoc"
+ name="bookchapter"
+ schema=".metadirectives.IBookChapterDirective"
+ handler=".metaconfigure.bookchapter" />
+
+</configure>
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/metaconfigure.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/metaconfigure.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,39 @@
+##############################################################################
+#
+# 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.1 (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.
+#
+##############################################################################
+"""Meta-Configuration Handlers for "help" namespace.
+
+These handlers process the `registerTopic()` directive of
+the "help" ZCML namespace.
+
+$Id: metaconfigure.py 26955 2004-08-09 04:06:35Z pruggera $
+"""
+__docformat__ = 'restructuredtext'
+import os.path
+import zope.app.apidoc.bookmodule
+from zope.app.onlinehelp.onlinehelptopic import RESTOnlineHelpTopic
+from book import book
+
+EMPTYPATH = os.path.join(
+ os.path.dirname(zope.app.apidoc.bookmodule.__file__),
+ 'empty.txt')
+
+def bookchapter(_context, id, title, doc_path=EMPTYPATH,
+ parent="", resources=None):
+ """Register an book chapter"""
+
+ _context.action(
+ discriminator = ('apidoc:bookchapter', parent, id),
+ callable = book.registerHelpTopic,
+ args = (parent, id, title, doc_path),
+ kw = {'resources': resources, 'class_': RESTOnlineHelpTopic})
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/metadirectives.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/metadirectives.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,57 @@
+##############################################################################
+#
+# 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.1 (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.
+#
+##############################################################################
+"""Schema for the ``apidoc:bookchapter`` directive
+
+$Id: metadirectives.py 28450 2004-11-13 21:05:19Z shane $
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.configuration.fields import Path, MessageID, Tokens
+from zope.interface import Interface
+from zope.schema import BytesLine, TextLine
+
+class IBookChapterDirective(Interface):
+ """Register a new Book Chapter"""
+
+ id = BytesLine(
+ title=u"Topic Id",
+ description=u"Id of the chapter as it will appear in the URL.",
+ required=True)
+
+ title = MessageID(
+ title=u"Title",
+ description=u"Provides a title for the chapter.",
+ required=True)
+
+ doc_path = Path(
+ title=u"Path to File",
+ description=u"Path to the file that contains the chapter content.",
+ required=False)
+
+ parent = BytesLine(
+ title=u"Parent Chapter",
+ description=u"Id of the parent chapter.",
+ default="",
+ required=False)
+
+ resources = Tokens(
+ title=u"A list of resources.",
+ description=u"""\
+ A list of resources which shall be user for the chapter.
+ The resources must be located in the same directory as
+ the chapter.
+ """,
+ value_type=TextLine(),
+ required=False
+ )
Added: Zope3/trunk/src/zope/app/apidoc/bookmodule/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/tests.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/tests.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Tests for the Book Documentation Module
+
+$Id: tests.py 29143 2005-02-14 22:43:16Z srichter $
+"""
+import unittest
+from zope.testing.doctestunit import DocTestSuite
+
+def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('zope.app.apidoc.bookmodule.browser'),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(default='test_suite')
Modified: Zope3/trunk/src/zope/app/apidoc/browser/contents.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/browser/contents.pt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/browser/contents.pt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -21,7 +21,7 @@
<h2>
<a target="menu" href=""
- tal:attributes="href string:./${module/name}/menu.html"
+ tal:attributes="href string:./${module/name}/@@menu.html"
tal:content="module/title">Module Title</a>
</h2>
Modified: Zope3/trunk/src/zope/app/apidoc/browser/modules.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/browser/modules.pt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/browser/modules.pt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -11,7 +11,7 @@
<ul class="modules">
<li tal:repeat="module view/getModuleList">
<a href="" target="menu"
- tal:attributes="href string:${module/name}/menu.html"
+ tal:attributes="href string:${module/name}/@@menu.html"
tal:content="module/title">
Interfaces
</a>
Modified: Zope3/trunk/src/zope/app/apidoc/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/configure.zcml 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/configure.zcml 2005-02-17 22:38:55 UTC (rev 29199)
@@ -28,11 +28,12 @@
<include package=".browser" />
<!-- API Documentation Modules -->
+ <include package=".bookmodule" />
<include package=".classmodule" />
<include package=".ifacemodule" />
+ <include package=".typemodule" />
<include package=".utilitymodule" />
<include package=".viewmodule" />
<include package=".zcmlmodule" />
- <!--include package=".cookbookmodule" /-->
</configure>
Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -431,15 +431,15 @@
>>> adapters = details.getRequiredAdapters()
>>> adapters.sort()
- >>> pprint(adapters)
- [[('factory',
- 'zope.app.location.traversing.LocationPhysicallyLocatable'),
- ('factory_url',
- 'zope/app/location/traversing/LocationPhysicallyLocatable'),
- ('name', ''),
- ('provided',
- 'zope.app.traversing.interfaces.IPhysicallyLocatable'),
- ('required', [])]]
+ >>> pprint(adapters[0])
+ [('factory',
+ 'zope.app.location.traversing.LocationPhysicallyLocatable'),
+ ('factory_url',
+ 'zope/app/location/traversing/LocationPhysicallyLocatable'),
+ ('name', ''),
+ ('provided',
+ 'zope.app.traversing.interfaces.IPhysicallyLocatable'),
+ ('required', [])]
"""
sm = zapi.getSiteManager()
# Must remove security proxies, so that we have access to the API
Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.pt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.pt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -20,12 +20,13 @@
<div tal:define="ifaces view/findInterfaces"
tal:condition="ifaces">
- <a href="" target="main"
- tal:repeat="info ifaces"
- tal:attributes="href info/url"
- tal:content="info/name">
- zope.app.component.interfaces.ILocalSiteManager
- </a>
+ <div tal:repeat="info ifaces">
+ <a href="" target="main"
+ tal:attributes="href info/url"
+ tal:content="info/name">
+ zope.app.component.interfaces.ILocalSiteManager
+ </a>
+ </div>
</div>
</div>
Added: Zope3/trunk/src/zope/app/apidoc/typemodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/typemodule/__init__.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/typemodule/__init__.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1 @@
+# Make a package
Added: Zope3/trunk/src/zope/app/apidoc/typemodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/typemodule/browser.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/typemodule/browser.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Browser Views for Interface Types
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+from zope.app import zapi
+from type import TypeInterface
+from zope.security.proxy import removeSecurityProxy
+
+class Menu(object):
+ """Menu View Helper Class"""
+
+ def getMenuTitle(self, node):
+ """Return the title of the node that is displayed in the menu."""
+ if zapi.isinstance(node.context, TypeInterface):
+ iface = node.context.interface
+ else:
+ iface = node.context
+ # Interfaces have no security declarations, so we have to unwrap.
+ return removeSecurityProxy(iface).getName()
+
+ def getMenuLink(self, node):
+ """Return the HTML link of the node that is displayed in the menu."""
+ return '../Interface/%s/apiindex.html' %zapi.name(node.context)
Added: Zope3/trunk/src/zope/app/apidoc/typemodule/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/typemodule/configure.zcml 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/typemodule/configure.zcml 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,30 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser">
+
+ <class class=".type.TypeModule">
+ <allow interface="zope.app.apidoc.interfaces.IDocumentationModule" />
+ <allow interface="zope.app.container.interfaces.IReadContainer" />
+ </class>
+
+ <class class=".type.TypeInterface">
+ <allow interface="zope.app.container.interfaces.IReadContainer"
+ attributes="interface" />
+ </class>
+
+ <!-- Register the module with the API Documentation System -->
+
+ <utility
+ provides="zope.app.apidoc.interfaces.IDocumentationModule"
+ factory=".type.TypeModule"
+ name="Type" />
+
+ <browser:page
+ for=".type.TypeModule"
+ permission="zope.app.apidoc.UseAPIDoc"
+ class=".browser.Menu"
+ name="menu.html"
+ template="menu.pt"
+ />
+
+</configure>
Added: Zope3/trunk/src/zope/app/apidoc/typemodule/menu.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/typemodule/menu.pt 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/typemodule/menu.pt 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,5 @@
+<html metal:use-macro="views/apidoc_macros/menu">
+<body>
+
+</body>
+</html>
\ No newline at end of file
Added: Zope3/trunk/src/zope/app/apidoc/typemodule/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/typemodule/tests.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/typemodule/tests.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,30 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Tests for the Book Documentation Module
+
+$Id: tests.py 29143 2005-02-14 22:43:16Z srichter $
+"""
+import unittest
+from zope.testing.doctestunit import DocTestSuite
+from zope.app.testing import placelesssetup
+
+def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('zope.app.apidoc.typemodule.type',
+ setUp=placelesssetup.setUp,
+ tearDown=placelesssetup.tearDown),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(default='test_suite')
Added: Zope3/trunk/src/zope/app/apidoc/typemodule/type.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/typemodule/type.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/typemodule/type.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -0,0 +1,120 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Interface Types Documentation Module
+
+$Id: __init__.py 29143 2005-02-14 22:43:16Z srichter $
+"""
+__docformat__ = 'restructuredtext'
+from zope.interface import implements
+from zope.interface.interfaces import IInterface
+
+from zope.app import zapi
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.location import LocationProxy
+from zope.app.location.interfaces import ILocation
+from zope.app.apidoc.interfaces import IDocumentationModule
+from zope.app.apidoc.utilities import ReadContainerBase
+
+
+class TypeInterface(ReadContainerBase):
+ """Representation of the special type interface.
+
+ Demonstration::
+
+ >>> from zope.interface import Interface
+ >>> class IFoo(Interface):
+ ... pass
+ >>> class Foo:
+ ... implements(IFoo)
+ >>> from zope.app.testing import ztapi
+ >>> ztapi.provideUtility(IFoo, Foo(), 'Foo')
+
+ >>> typeiface = TypeInterface(IFoo, None, None)
+ >>> typeiface.interface
+ <InterfaceClass zope.app.apidoc.typemodule.type.IFoo>
+
+ >>> typeiface.get('Foo').__class__ == Foo
+ True
+
+ >>> typeiface.items() #doctest:+ELLIPSIS
+ [(u'Foo', <zope.app.apidoc.typemodule.type.Foo instance at ...>)]
+
+ """
+
+ implements(ILocation)
+
+ def __init__(self, interface, parent, name):
+ self.__parent__ = parent
+ self.__name__ = name
+ self.interface = interface
+
+ def get(self, key, default=None):
+ """See zope.app.container.interfaces.IReadContainer"""
+ return LocationProxy(
+ zapi.queryUtility(self.interface, key, default=default),
+ self, key)
+
+ def items(self):
+ """See zope.app.container.interfaces.IReadContainer"""
+ results = [(name, LocationProxy(iface, self, name))
+ for name, iface in zapi.getUtilitiesFor(self.interface)]
+ results.sort(lambda x, y: cmp(x[1].getName(), y[1].getName()))
+ return results
+
+
+class TypeModule(ReadContainerBase):
+ r"""Represent the Documentation of all interface types.
+
+ Demonstration::
+
+ >>> class IFoo(IInterface):
+ ... pass
+
+ >>> from zope.app.testing import ztapi
+ >>> ztapi.provideUtility(IInterface, IFoo, 'IFoo')
+
+ >>> module = TypeModule()
+ >>> type = module.get('IFoo')
+
+ >>> type.interface
+ <InterfaceClass zope.app.apidoc.typemodule.type.IFoo>
+
+ >>> [type.interface for name, type in module.items()]
+ [<InterfaceClass zope.app.apidoc.typemodule.type.IFoo>]
+ """
+
+ implements(IDocumentationModule)
+
+ # See zope.app.apidoc.interfaces.IDocumentationModule
+ title = _('Interface Types')
+
+ # See zope.app.apidoc.interfaces.IDocumentationModule
+ description = _("""
+ Here you can see all registered interface types. When you open the subtree
+ of a specific interface type, you can see all the interfaces that provide
+ this type. This can be very useful in cases where you want to determine
+ all content type interfaces, for example.
+ """)
+
+ def get(self, key, default=None):
+ return TypeInterface(
+ zapi.queryUtility(IInterface, key, default=default), self, key)
+
+ def items(self):
+ results = [(name, TypeInterface(iface, self, name))
+ for name, iface in zapi.getUtilitiesFor(IInterface)
+ if iface.extends(IInterface)]
+ results.sort(lambda x, y: cmp(x[1].interface.getName(),
+ y[1].interface.getName()))
+ return results
Modified: Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py 2005-02-17 22:33:55 UTC (rev 29198)
+++ Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py 2005-02-17 22:38:55 UTC (rev 29199)
@@ -94,10 +94,11 @@
def items(self):
"""See zope.app.container.interfaces.IReadContainer"""
- sm = zapi.getSiteManager()
+ sm = zapi.getGlobalSiteManager()
items = [(reg.name or NONAME, Utility(self, reg))
for reg in sm.registrations()
- if self.interface == reg.provided]
+ if zapi.isinstance(reg, UtilityRegistration) and \
+ self.interface == reg.provided]
items.sort()
return items
More information about the Zope3-Checkins
mailing list