I am using zcml:condition="installed zopyx.typesense"
in a custom policy package in various configure.zcml
files. Plone 6/Zope does not ignore the configuration registrations if zopyx.typesense
is not installed. Is this a known issue?
Theoretically that should work also on Plone6, it would be really bad if that was not the case.
A lot of:
zcml:condition="installed Products.Archetypes"
would make the instance not start.
That makes me think that for some reason you can import zopyx.typesense
.
I had some weird issues when providing aliases, see zcml condition for including archetypes related code is not specific enough · Issue #1004 · plone/plone.restapi · GitHub
That's the only thing that comes to my mind.
Good luck!
Obviously, there is a problem:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:zcml="http://namespaces.plone.org/zcml"
i18n_domain="zopyx.typesense">
<adapter
zcml:condition="installed fooo"
for="*"
provides="zopyx.typesense.interfaces.ITypesenseIndexDataProvider"
factory=".typesense.TypesenseIndexer"
/>
</configure>
Since there is no package fooo
installed, the startup process should ignore this registration.
However, it fails:
mlreader.IncrementalParser.parse(self, source)
File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/xml/sax/xmlreader.py", line 125, in parse
self.feed(buffer)
File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/xml/sax/expatreader.py", line 217, in feed
self._parser.Parse(data, isFinal)
File "/private/tmp/pythonA3.9-20220524-11817-14wjtef/Python-3.9.13/Modules/pyexpat.c", line 461, in EndElement
File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/xml/sax/expatreader.py", line 381, in end_element_ns
self._cont_handler.endElementNS(pair, None)
File "/Users/ajung/src/plone6.buildout/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/xmlconfig.py", line 395, in endElementNS
self._handle_exception(ex, info)
File "/Users/ajung/src/plone6.buildout/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/xmlconfig.py", line 393, in endElementNS
self.context.end()
File "/Users/ajung/src/plone6.buildout/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/config.py", line 703, in end
self.stack.pop().finish()
File "/Users/ajung/src/plone6.buildout/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/config.py", line 872, in finish
args = toargs(context, *self.argdata)
File "/Users/ajung/src/plone6.buildout/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/config.py", line 1704, in toargs
reraise(
File "/Users/ajung/src/plone6.buildout/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/_compat.py", line 31, in reraise
raise value.with_traceback(tb)
File "/Users/ajung/src/plone6.buildout/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/config.py", line 1702, in toargs
args[str(name)] = field.fromUnicode(s)
File "/Users/ajung/src/plone6.buildout/eggs/zope.configuration-4.4.1-py3.9.egg/zope/configuration/fields.py", line 175, in fromUnicode
raise ValidationError(v).with_field_and_value(self, name)
zope.configuration.exceptions.ConfigurationError: Invalid value for 'provides'
File "/Users/ajung/src/plone6.buildout/parts/instance/etc/site.zcml", line 16.2-16.23
File "/Users/ajung/src/plone6.buildout/eggs/Products.CMFPlone-6.0.0a6-py3.9.egg/Products/CMFPlone/configure.zcml", line 118.2-122.8
File "/Users/ajung/src/plone6.buildout/src/eteaching.policy2/src/eteaching/policy2/configure.zcml", line 18.2-18.33
File "/Users/ajung/src/plone6.buildout/src/eteaching.policy2/src/eteaching/policy2/adapters/configure.zcml", line 9.4-14.10
zope.schema._bootstrapinterfaces.ValidationError: ImportError: Couldn't import zopyx.typesense.interfaces, No module named 'zopyx.typesense'
1 Like
It is xmlns:zcml="http://namespaces.zope.org/zcml"
(and not plone.org).
OMG of course
1 Like