Text File

The ZCML Documentation Module

This documentation module provides you with a complete reference of all directives available on your Zope 3 installation.

ZCMLModule class

The ZCML module class manages all available ZCML namespaces. Once we initialize the module

>>> from zope.app.apidoc.zcmlmodule import ZCMLModule
>>> module = ZCMLModule()

it evaluates all meta directives and creates the namspace list:

>>> module.get('http://namespaces.zope.org/browser').getFullName()

You can also access the namespace via its encoded form:

>>> module.get(
...     'http_co__sl__sl_namespaces.zope.org_sl_browser').getFullName()

and via its short form:

>>> module.get('browser').getFullName()

If the module does not exist, the usual None is returned:

>>> module.get('foo') is None

You can also list all namespaces:

>>> names = [n for n, ns in module.items()]
>>> 'ALL' in names
>>> 'http_co__sl__sl_namespaces.zope.org_sl_browser' in names
>>> 'http_co__sl__sl_namespaces.zope.org_sl_meta' in names

Namespace class

Simple namespace object for the ZCML Documentation Module.

The namespace manages a particular ZCML namespace. The object always expects the parent to be a ZCMLModule instance. So let's create a namespace:

>>> module = ZCMLModule()
>>> module._makeDocStructure()
>>> from zope.app.apidoc.zcmlmodule import Namespace
>>> ns = Namespace(ZCMLModule(), 'http://namespaces.zope.org/browser')

We can now get its short name, which is the name without the URL prefix:

>>> ns.getShortName()

and its full name in unquoted form:

>>> ns.getFullName()

or even quoted:

>>> ns.getQuotedName()

One can get a directive using the common mapping interface:

>>> ns.get('pages').__name__
>>> ns.get('foo') is None
>>> print '\n'.join([name for name, dir in ns.items()][:3])


Quotes a namespace to make it URL-secure.

>>> from zope.app.apidoc.zcmlmodule import quoteNS
>>> quoteNS('http://namespaces.zope.org/browser')


Un-quotes a namespace from a URL-secure version.

>>> from zope.app.apidoc.zcmlmodule import unquoteNS
>>> unquoteNS('http_co__sl__sl_namespaces.zope.org_sl_browser')