[Zope] ZCA / five / zcml overrides issue...
Bruno Desthuilliers
bruno at websiteburo.com
Fri Mar 26 06:00:19 EDT 2010
Hi there
I probably missed some point about how this Component Architecture /
ZCML config stuff is supposed to work with zope 2.10+ (actually Zope
2.10.5), ,so any hint or pointer welcome...
Here's my problem:
I use a third-part product (ContentMirror) that defines some interfaces
and their implementations, and register the adapters in it's
configure.zcml. It also defines a couple zcml directives, with actions
that call component.getMultiAdapter to retrieve the implementation for
these interfaces.
I'd like to provide my own implementation for one of these interfaces.
So I wrote the implementation, added an <include> of the ContentMirror
package in my own configure.zcml, and an overrides.zcml with the
registration directive for my own implementation:
<configure xmlns="http://namespaces.zope.org/zope">
<!-- use our own PeerFactory implementation instead -->
<adapter
for="ore.contentmirror.interfaces.IMirrored
ore.contentmirror.interfaces.ISchemaTransformer"
provides="ore.contentmirror.interfaces.IPeerFactory"
factory=".peer.ManagedSchemaPeerFactory"
/>
</configure>
Bad luck, the whole thing then crashes when ContentMirror's own zcml
directive are executed - looks like none of the adapter are effectively
registred by that time (it of course worked just fine - but with the
original IPeerfactory implementation - before I added this override).
Here's the traceback I get at startup:
2010-03-23 11:41:41 ERROR Application Couldn't install Five
Traceback (most recent call last):
File "/home/zope/share/Plone-3.0.6/lib/python/OFS/Application.py",
line 786, in install_product
initmethod(context)
File
"/home/zope/share/Plone-3.0.6/lib/python/Products/Five/__init__.py",
line 28, in initialize
zcml.load_site()
File "/home/zope/share/Plone-3.0.6/lib/python/Products/Five/zcml.py",
line 53, in load_site
_context = xmlconfig.file(file)
File
"/home/zope/share/Plone-3.0.6/lib/python/zope/configuration/xmlconfig.py",
line 581, in file
context.execute_actions()
File
"/home/zope/share/Plone-3.0.6/lib/python/zope/configuration/config.py",
line 612, in execute_actions
callable(*args, **kw)
File
"/home/zope/share/Products/ProductsOTHERS/ContentMirror/eggs/ore.contentmirror-0.5.2b2-py2.4.egg/ore/contentmirror/loader.py",
line 39, in load
peer_class = self.peer( instance, transformer )
File
"/home/zope/share/Products/ProductsOTHERS/ContentMirror/eggs/ore.contentmirror-0.5.2b2-py2.4.egg/ore/contentmirror/loader.py",
line 51, in peer
interfaces.IPeerFactory )
File "/home/zope/share/Plone-3.0.6/lib/python/zope/component/_api.py",
line 103, in getMultiAdapter
raise ComponentLookupError(objects, interface, name)
ConfigurationExecutionError:
zope.component.interfaces.ComponentLookupError: ((<ATDocument at
transient>, <ore.contentmirror.transform.SchemaTransformer object at
0xb6e028c>), <InterfaceClass ore.contentmirror.interfaces.IPeerFactory>,
u'')
in:
File
"/home/zope/share/Products/ProductsOTHERS/ContentMirror/eggs/ore.contentmirror-0.5.2b2-py2.4.egg/ore/contentmirror/content.zcml",
line 3.4-3.80
<ore:mirror
content="Products.ATContentTypes.content.document.ATDocument" />
I obviously did something wrong - but what ???
TIA
--
bruno desthuilliers
bruno at websiteburo.com
More information about the Zope
mailing list