Re: Could it be possible to support configuring with *.cfg instead of *.zcml?
Robert Niederreiter <rnix-vzgNpXZZ1Rwgm7i/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Am 23.11.2013 22:42, schrieb Asko Soukka:
> 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.
Nested directives is definitely a showstopper here, using cfg files
would imply to implement a semantic hack in order to achieve nested
directives or skip them at all. Both is not desireable.
As alternative to cfg files YAML might be discussed, which actually
looks prettier than XML and can be used to describe nested structures.
Your example would look similar to this
configure:
- browserpage:
name: foo
for: *
class: .foo.Foo
permission: zope2.View
template: foo.pt
Anyway, i fear that there's not that big interest in changing or
extending the way ZCA registration works at all, as grok showed people
are basically fine with using ZCML (even if they're not big XML
enthusiasts) and prefer the use of not-so-loved syntax over another
package adding complexity and thus possible confusion.
Robert
>
> 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
> _______________________________________________
> Plone-developers mailing list
> Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/plone-developers
------------------------------------------------------------------------------
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