Re: Could it be possible to support configuring with *.cfg instead of *.zcml?
"David Glick (Plone)" <david.glick-z4DKO/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
On 11/24/13, 3:58 AM, Asko Soukka wrote: > Hi Robert, > > Thanks for your comments. > > Robert Niederreiter wrote: >> 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. > Agreed. So, the technical issues against cfg: > > - requirement for unique section headers > - cannot support nested directives > > Where nested directives are still required in Plone context? I remember > seeing only <class><require/></class> (and in many cases there would > have been less lines with a single directive). > >> As alternative to cfg files YAML might be discussed, which actually >> looks prettier than XML and can be used to describe nested structures. > I also thought about YAML, but I'm not sure how widely it's adopted > elsewhere within Python developers. Also, it would be a completely new > syntax in Plone stack. > >> 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. > True. > > We have to teach a couple of new Plone developers every year. > Grok-approach has been easier for them to become productive, but sooner > or later there is the infamous Z-curve in learning. This time where grok > does not work and you still have to learn zcml. Next year I've thinking > about teaching zcml first, again... > > That's why I'm thinking about extending zope.configuration instead of > inventing something completely new (like grok was). That way it should > be easier to reach feature parity with zcml (because all the same > directives are used). > > Maybe zope.configuration could be extended to use venusian.scan to > register directives, when there is configure.py in your package.. > A month ago I experimented with some code to automatically translate ZCML into Python-based configuration, using an AST-based approach similar to Chameleon. The result for Plone 4.3: https://gist.github.com/davisagli/7047450 I'm not seriously proposing pursuing this as a change in configuration style. My motivation was to see whether caching and executing Python bytecode could lead to improved performance for startup compared to parsing XML. Unfortunately there wasn't a big improvement; most of the startup time is spent importing and executing modules. Someone should check over that gist, though, and make sure we aren't accidentally configuring a bunch of things we don't use. I agree with others that it's almost impossible to introduce a new style of configuration in a way that actually makes things simpler. If you have any use or interest in the zcml2py translation code I can post it, but it'll take a bit of cleanup first as it's currently spread through several places. David ------------------------------------------------------------------------------ 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