Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What to do when two distributions have the same name. #87

Open
mauritsvanrees opened this issue Jun 19, 2024 · 0 comments
Open

What to do when two distributions have the same name. #87

mauritsvanrees opened this issue Jun 19, 2024 · 0 comments

Comments

@mauritsvanrees
Copy link
Member

Currently both plone.distribution and plone.classicui define a "classic" distribution. When I start an instance with both packages, I would expect a zcml conflict error. For better or worse, this does not happen, and Plone starts up. In the UI, the classic distribution shows up only once (plus the volto one), and in my case the one from plone.classicui wins. This may depend on the order in which the packages are read.

To avoid confusion, it is probably better to throw a ConfigurationConflictError.

Ah, when you define two the same distros in the same package, you do get such an error. Copy this in plone.classicui:

  <plone:distribution
      name="double"
      title="Double 1"
      description="Double"
      headless="false"
      post_handler="plone.distribution.handler.post_handler"
      />
  <plone:distribution
      name="double"
      title="Double 2"
      description="Double"
      headless="false"
      post_handler="plone.distribution.handler.post_handler"
      />

Start up:

  File "/Users/maurits/shared-eggs/cp312/Zope-5.10-py3.12.egg/Zope2/App/zcml.py", line 45, in load_site
    _context = xmlconfig.file(site_zcml)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurits/shared-eggs/cp312/zope.configuration-5.0-py3.12.egg/zope/configuration/xmlconfig.py", line 664, in file
    context.execute_actions()
  File "/Users/maurits/shared-eggs/cp312/zope.configuration-5.0-py3.12.egg/zope/configuration/config.py", line 781, in execute_actions
    for action in resolveConflicts(self.actions):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurits/shared-eggs/cp312/zope.configuration-5.0-py3.12.egg/zope/configuration/config.py", line 1824, in resolveConflicts
    raise ConfigurationConflictError(conflicts)
zope.configuration.config.ConfigurationConflictError: Conflicting configuration actions
  For: ('register', 'plone.classicui', 'double')
    File "/Users/maurits/community/plone-coredev/6.1/src/plone.classicui/src/plone/classicui/configure.zcml", line 13.2-19.8
        <plone:distribution
            name="double"
            title="Double 1"
            description="Double"
            headless="false"
            post_handler="plone.distribution.handler.post_handler"
            />
    File "/Users/maurits/community/plone-coredev/6.1/src/plone.classicui/src/plone/classicui/configure.zcml", line 20.2-26.8
        <plone:distribution
            name="double"
            title="Double 2"
            description="Double"
            headless="false"
            post_handler="plone.distribution.handler.post_handler"
            />

But when they are defined in separate packages, Plone starts up fine.

Probably the discriminator here should not have product in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant