[Zope3-dev] RFC: zcml:condition
Jim Fulton
jim at zope.com
Thu Feb 17 17:30:29 EST 2005
Roger Ineichen wrote:
> Hi Jim
>
>>-----Original Message-----
>>From: zope3-dev-bounces+dev=projekt01.ch at zope.org
>>[mailto:zope3-dev-bounces+dev=projekt01.ch at zope.org] On
>>Behalf Of Jim Fulton
>>Sent: Thursday, February 17, 2005 10:42 PM
>>To: zope3-dev at zope.org
>>Subject: [Zope3-dev] RFC: zcml:condition
>>
>>
>>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>
>
>
> Can we use this condition like a sub configure directive:
>
> <configure
> xmlns="http://namespaces.zope.org/zope">
>
> <browser:page
> name="foo"
> template="foo.pt"
> ...
> />
>
> <configure
> 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"
> />
> </configure>
>
> </configure>
Yup.
> Or what's the scope of the zcml:condition.
The condition attribute applies to the elements it's on (and all
subelements, of course). It can go on any element in zcml.
The condigure directive is a pure grouping directive. It can be
used as many times as you want. It's roughly the zcml equivalent
of div.
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