Skip to content

Introduce buildout:zcml-additional-fragments buildout variable#10

Merged
lukasgraf merged 1 commit intomasterfrom
lg-tika-server-zcml-additional
Mar 27, 2014
Merged

Introduce buildout:zcml-additional-fragments buildout variable#10
lukasgraf merged 1 commit intomasterfrom
lg-tika-server-zcml-additional

Conversation

@lukasgraf
Copy link
Copy Markdown
Contributor

This PR introduces a buildout:zcml-additional-fragments buildout variable that can be used to effectively extend the resulting zcml-additional with += assignments.

This is motivated by ZCML needed for ftw.tika:
tika-server.cfg currently includes

[instance0]
zcml-additional += ${tika:zcml}

While it's a nice idea that tika-server.cfg is completely self-configuring, I don't think this can work reliably:

  • instance0:zcml-additional often gets overridden in buildouts that extend from the ftw-buildouts.
  • Because everything in zcml-additional needs to be wrapped in a single <configure /> element, appending to it from multiple places using += doesn't work.

Therefore I suggest to remove that zcml-additional += ${tika:zcml} and instead document in README.rst how to add tika's ZCML to instance0:zcml-additional in the buildout that extends from tika-server.cfg. That way its left to the developer to make sure the ZCML is included properly in whatever other additional ZCML he has in his buildout.

This issue really should be fixed in plone.recipe.zope2instance I guess - always wrap the contents of zcml-additional in an outer <configure /> element if it contains more than one element.

As a work-around, we do this in some of our buildouts:

  • Define buildout:zcml-additional-fragments
  • Append to buildout:zcml-additional-fragments from multiple places using +=
  • Wrap its contents in a <configure /> node and set zcml-additional to that:
    [instance0]
    zcml-additional =
        <configure xmlns="http://namespaces.zope.org/zope">
            ${buildout:zcml-additional-fragments}
        </configure>

Maybe this pattern could also be useful in ftw-buildouts.
@jone any thoughts on this?

@lukasgraf
Copy link
Copy Markdown
Contributor Author

PullRequest created for plone.recipe.zope2instance: plone/plone.recipe.zope2instance#13

@jone
Copy link
Copy Markdown
Member

jone commented Mar 24, 2014

@lukasgraf I see your points.

The most important thing for me is that I don't have to think / do things when I use it in a "default" setup, meaning when I don't override zcml-additional. Currently this is the only place in ftw-buildouts where zcml-additional is used, so the buildouts here don't yet have this problem.

The zcml-additional-fragments looks very promising, I think we should define this as standard for all ftw-buildouts and wrap the zcml-additional by default as you suggested. But I'd like to have this included in this pull-request, so that existing buildouts using the tika configuration from here do not break.

@jone
Copy link
Copy Markdown
Member

jone commented Mar 26, 2014

@lukasgraf I've pushed my proposal to your branch, implementing the zcml-additional-fragments buildout variable. Please take a look 😉

@lukasgraf
Copy link
Copy Markdown
Contributor Author

@jone excellent! Going to drop my commit, change the title of the PR to something more generic and merge it.

@lukasgraf lukasgraf changed the title Don't try to set zcml-additional from tika-server.cfg Introduce buildout:zcml-additional-fragments buildout variable 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
lukasgraf added a commit that referenced this pull request Mar 27, 2014
Introduce buildout:zcml-additional-fragments buildout variable
@lukasgraf lukasgraf merged commit 24be469 into master Mar 27, 2014
@lukasgraf lukasgraf deleted the lg-tika-server-zcml-additional branch March 27, 2014 09:01
jone added a commit to 4teamwork/ftw.book that referenced this pull request Apr 29, 2014
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.

2 participants