plonesetuptoolszopebuildoutzcml

ZCML configuration conflict between Zope2 and another zope.* package


I have a Plone add-on with the following setup.py

setup(
    ...
    install_requires=[
        ...
        'zope.i18n',
        ...
        'Zope2',
    ],
    ...
)

If I run bin/instance I get the following traceback:

  File ".buildout/eggs/zope.configuration-3.7.4-py2.7.egg/zope/configuration/config.py", line 1527, in resolveConflicts
    raise ConfigurationConflictError(conflicts)
zope.configuration.config.ConfigurationConflictError: Conflicting configuration actions
  For: ('utility', <InterfaceClass zope.i18n.interfaces.INegotiator>, '')
    File ".buildout/eggs/zope.i18n-3.7.4-py2.7.egg/zope/i18n/configure.zcml", line 3.2-6.8
        <utility
            provides="zope.i18n.interfaces.INegotiator"
            component="zope.i18n.negotiator.negotiator"
            />
    File ".buildout/eggs/Zope2-2.13.22-py2.7.egg/ZPublisher/i18n.zcml", line 5.2-8.8
        <utility 
            provides="zope.i18n.interfaces.INegotiator"
            component="zope.i18n.negotiator.negotiator"
            />

If I comment out zope.i18n from setup.py, run buildout again, then the instance starts fine.

Surprisingly enough, both bin/instance files (before and after removing zope.i18n) are exactly the same.

So I'm sort of left clueless about what's wrong on defining something on setup.py that anyway the same version gets picked...

Last note, on the distribution's main configure.zcml I have this line:

<includeDependencies package="." />

Does this matter at all?


Solution

  • That seems odd?? obviously it's not possible to registry twice the same utility, but both packages do? I'm very confused about that. Usually you don't need the <includeDependencies package="." /> parts, since all components should be loaded by the plone entry point of z3c.autoinclude. I assume in a default plone environment, one of the components will not be loaded.

    I checked in on a Plone 4.3.6... The Negotiator of zope.i18n is used.

    So my best bet is, that your <includeDependencies package="." />, also loads the configure.zcml of Zope2, which should not happen.

    Removing the <includeDependencies package="." />, may solve your issue.