Re: Could it be possible to support configuring with *.cfg instead of *.zcml?

Asko Soukka <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
Ahem, just continuing after accidental send:

Asko Soukka wrote:
> The benefit would be that add-on developer could write configure.cfg:
>
> [browser:page:uniquepostfix]
> name = hello-world
> for = *
> class = .view.FooBar
> permission = zope2.View
>
> instead of configure.zcml

<configure
     xmlns="http://namespaces.zope.org/zope"
     xmlns:browser="http://namespaces.zope.org/browser">

     <browser:page
         name="hello-world"
         for="*"
         class=".view.FooBar"
         permission="zope2.View"
         />

</configure>

Cfg may not be significantly better than zcml, just not xml.

What all issues would there be left to be solved?

At least, cfg would be flatter. I have no idea, where directives inside 
directives are really needed, so I don't know can everything be 
implemented in cfgs.

It should not difficult to support zcml:condition, so conditional 
sections could be solved into conditional include-directives.

Cfg-sections would need to be unique, which would require something 
dummy after the directive name.

Do we have any colliding namespaces, which would prevent fixing e.g. 
that browser to always mean http://namespaces.zope.org/browser

Directives ZCMLs are executed in order. Forcing order with cfg would 
need something like "require = section:name" (like in puppet).

> I made a very naive experiment:
>
> https://github.com/datakurre/collective.cfgconfig

Cheers,
Asko

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.