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

Always wrap contents of zcml-additional with a <configure /> node. #13

Merged
merged 1 commit into from
Apr 9, 2014

Conversation

lukasgraf
Copy link
Member

This makes it possible to use += assignments with zcml-additional.

Currently, the contents of zcml-additional are dumped as-is in 999-additional-overrides.zcml. This means that you can't use zcml-additional += assignments to add to an instance's additional ZCML from multiple places, because you will end up with a 999-additional-overrides.zcml that contains multiple top level nodes (which isn't valid XML).

In this PR I wrap the contents of zcml-additional in <configure /> node (including the Zope XMLNS) before writing them to the file.

This is done unconditionally, so even if zcml-additional only contains one element, it will be wrapped. However, because <configure /> directives can be nested to arbitrary depths (see zope.configuration.zopeconfigure, this should not be a problem, and the simplicity of the change outweighs the possible redundancy in my opinion.

@gforcada
Copy link
Sponsor Member

+1!

@lukasgraf
Copy link
Member Author

@esteele any objections to me merging this one?

@esteele
Copy link
Sponsor Member

esteele commented Mar 24, 2014

Any implications for existing installations?

@lukasgraf
Copy link
Member Author

@esteele I can't see any.
I tested the case where the contents on an existing zcml-additional were already wrapped with a <configure /> node, and got wrapped again with my change - still works. So even if it may add some unnecessary nesting in some cases, all existing uses of zcml-additional should work just like before from what I understand.

@jone
Copy link
Member

jone commented Mar 26, 2014

👍 would be great to have this fix!

jone added a commit to 4teamwork/ftw-buildouts that referenced this pull request Mar 26, 2014
The buildout:zcml-additional-fragments variable helps wrapping the instanceX:zcml-additional
option with a root configuration node, which allows to append to the
buildout:zcml-additional-fragments any ZCML which will then properly set up.

For more information regarding the source of the problem take a look at:
plone/plone.recipe.zope2instance#13
lukasgraf added a commit to 4teamwork/ftw-buildouts that referenced this pull request Mar 27, 2014
The buildout:zcml-additional-fragments variable helps wrapping the instanceX:zcml-additional
option with a root configuration node, which allows to append to the
buildout:zcml-additional-fragments any ZCML which will then properly set up.

For more information regarding the source of the problem take a look at:
plone/plone.recipe.zope2instance#13
@davisagli
Copy link
Sponsor Member

I just set up Travis CI for this package. Please update your branch to include .travis.yml so we can make sure the tests still pass.

This makes it possible to use += assignments with zcml-additional.
@lukasgraf
Copy link
Member Author

@davisagli great, thanks! Rebased my branch onto master.

davisagli added a commit that referenced this pull request Apr 9, 2014
…figure

Always wrap contents of zcml-additional with a <configure /> node.
@davisagli davisagli merged commit d9d355b into master Apr 9, 2014
@davisagli davisagli deleted the lgraf-wrap-additional-zcml-with-configure branch April 9, 2014 05:15
lukasgraf added a commit to 4teamwork/kgs that referenced this pull request Apr 10, 2015
makes sure we're using a version of the recipe that supports
using "zcml-additional += ..." assignments (see
plone/plone.recipe.zope2instance#13)
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

Successfully merging this pull request may close these issues.

5 participants