[Product-Developers] RFC: Venusian-based Python-syntax alternative for ZCML-configuration

Asko Soukka asko.soukka at iki.fi
Mon Jan 6 13:35:18 UTC 2014


Hi Mikko,

thanks for taking part :)

Mikko Ohtamaa wrote:
> Python can make things pretty for you.
>
> with has_package("plone.app.z3cform", version=">1.3.0"):
>        # do something

That's very nice.

> Also all scans should be explicit, preferably not executed on the module
> body level. If you put things to a function e.g.

All scans must already be explicit, and currently recursive scans are 
not supported, so each module must be scanned separately. I like it very 
exlicit, so I'm not sure, should I hurry support for recursive scan.

> def configurare():
>        ... configure my package...
>
> And then those configure()s are executed in well-known order, the
> package author has more leverage and tools in the possession to tackle
> potential conflict issues (E.g. as the last resolt monkey-patch another
> configure())

Currently importing module does not execute anything, but just registers 
venusian callbacks for zope.configuration calls and venusian scans 
(which would execute more zope configuration calls). Registered venusian 
callbacks only executed when package is included in zope.configuration.

This makes execution order very explicit. All zope.configuration rules 
do apply, so configuration for the other monkeypatching package could be 
included before own package.

So, while I've been thinking about def configure(), I'm not sure if it's 
necessary. It would add one more thing to know (and different from zcml) 
and one more indentation level for configuration file.

Also, it starts looking weird, when one has configure.py:

def configure():
     from collective.venusianconfig import configure

     configure.gs.registerProfile(...)

("configure" configuration class is currently named after the zcml root 
tag "configure")

Regards,
Asko


More information about the Product-Developers mailing list