Package: venusianconfiguration
venusianconfigurationThis package (venusianconfiguration) providesvenusianbased Python
configuration syntax forzope.configurationas an alternative to zcml.
This package does not replacezope.configurationlikegrokused to do,
but just provides generic Python bindings for existing zope.configuration
directives.
So, venusianconfiguration is more an alternative to grok than it is to
zope.configuration.The current status of this package can be described asalready in internal
use, but maybe not yet ready for the community.The good:fromvenusianconfigurationimportconfigureconfigure.i18n.registerTranslations(directory='locales')@configure.browser.page.klass(name='hello-world',for_=Interface,permission='zope2.View')classHelloWorld(BrowserView):def__call__(self):returnu'Hello world!'@configure.plone.behavior.provides(title=_(u'My behavior),description=_(u'Enables magic'))classIMyBehavior(model.Schema):custom_field=schema.TextLine()alsoProvides(IMyBehavior,IFormFieldProvider)The bad:fromvenusianconfigurationimportscanfromvenusianconfigurationimportconfigurefrommypackageimportbrowserscan(browser)importzcmlpackageconfigure.include(package=zcmlpackage)importotherpypackageconfigure.include(package=otherpypackage,file='configure.py')importmypackage.submoduleconfigure.include(package=mypackage.submodule,file='configure.py')The ugly:zope.configurationis mostly syntax-agnostic, but unfortunately
ZCML has been the only implemented syntax for it and we have also
used to call its ZCML-specific API directly (e.g. in test fixtures
and in z3c.autoinclude).Therefore a new zope.configuration syntax cannot be introduced outside
zope.configuration without monkeypatching…venusianconfigurationworks by monkeypatching the processxmlfile
method inzope.configuration’s ZCML-support to accept also Python
files pass those to venusianconfiguration to process.To supportz3c.autoinclude,venusianconfigurationalso monkeypatches
z3c.autoincludes’s includePluginsDirective and includePluginsOveridesDirective
(includeDependencies-directive is considered evil and is intentionally left
unsupported).So, three monkeypatches in total for zcml-free configuration.Usage[instance]recipe=plone.recipe.zope2instance...eggs=...venusianconfigurationzope-conf-additional=# Enable venuasianconfiguration monkeypatches%import venusianconfigurationFor more examples, look into the demo-package included in the sources.TroubleshootingBecause the configuration now written in Python, your add-on must have its
namespaces packages properly defined in its setup.py. E.g. add-on called
my.product would have following namespace package definition:setup(...namespace_packages=['my'],...)Even there’s no ZCML, the add-on must be registered to be configured. This can
be done by adding the usual z3c.autoinclude-entrypoint into add-on’s setup.py:setup(...entry_points="""
    # -*- Entry points: -*-
    [z3c.autoinclude.plugin]
    target = plone
    """)An alternative would be to add the package into the zcml-option of your
Plone instance’s buildout-part for plone.recipe.zope2instance:[instance]recipe=plone.recipe.zope2instance...zcml=my.productChangelog1.1.2 (2021-09-01)Fix issue where PEP 320 hook failed on Plone 5.2 because dummy component.xml was returned as string instead of bytes
[datakurre]1.1.1 (2018-11-07)Add faceted namespace
[datakurre]1.1.0 (2018-01-17)Drop z3c.autoinclude plugin entrypoint for plone to fix issues with where
z3c.autoinclude included wrong packages on and pip-installed Plone. This
will disable the experimental ZCML directives from meta.zcml to be loaded
by default with Plone.
[datakurre]1.0.2 (2017-12-21)Fix issue where default configuration directive being mutable caused
unexpected behavior
[datakurre]1.0.1 (2016-09-21)Fix issue where zope.deferredimported module was not recognized as module
[datakurre]1.0.0 (2016-04-19)First release.