[Zope3-dev] RFC: zcml:condition
Jim Fulton
jim at zope.com
Thu Feb 17 16:42:13 EST 2005
We've identified a real need for conditional ZCML
processing.
Consider an optional feature, like onlinehelp or zsync.
These system define directives or components that individual
packages will want to provide if these systems are available.
For example, a package might want to register on-line-help
documents if the on-line help system is available:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:help="http://namespaces.zope.org/help"
zcml:condition="have onlinehelp"
>
<help:register
id="zope.app.authentication"
parent="dev"
title="Authentication"
doc_path="README.txt"
class="zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic"
/>
<help:register
id="principalfolder"
parent="dev/zope.app.authentication"
title="Principal Folder"
doc_path="principalfolder.txt"
class="zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic"
/>
<help:register
id="groupfolder"
parent="dev/zope.app.authentication"
title="Group Folder"
doc_path="groupfolder.txt"
class="zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic"
/>
</configure>
Our previous attempt at something like this:
http://svn.zope.org/?rev=28766&view=rev
allowed tales expressions as condition values. Martijn objected
that this was too powerful and we removed the feature.
I'd like to propose a much simpler language for condition
values:
verb arguments
The arguments depend on the verb.
Initially, we'd implement a single verb, "have", that
takes a feature name.
We'd also provide a meta configuration directive:
<meta:provide feature="featurename" />
(as in <meta:provide feature="onlinehelp" />)
A condition with a "have" command will be true if there was
a previous provides directive for the named feature.
Thoughts?
Marius volunteered to write this this weekend, so I'd
like to reach consensus quickly. :)
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list