If you go to ZMI -> Plone Site Root -> Interfaces Tab in a naked latest coredev 5.1 buildout a traceback pops up
2017-06-23 15:26:46 ERROR Zope.SiteErrorLog 1498224406.690.998173435963 http://localhost:8080/Plone/manage_interfaces
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.Five.utilities.browser.marker, line 36, in __call__
Module Products.Five.browser.pagetemplatefile, line 125, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module five.pt.engine, line 98, in __call__
Module z3c.pt.pagetemplate, line 163, in render
Module chameleon.zpt.template, line 261, in render
Module chameleon.template, line 191, in render
Module chameleon.template, line 171, in render
Module 9fc92c027892bb42d033de28d6335afd.py, line 165, in render
Module cd1ef4ea562db21d6061c596483a8547.py, line 417, in render_main
Module five.pt.expressions, line 161, in __call__
Module Products.Five.utilities.browser.marker, line 49, in getAvailableInterfaceNames
Module Products.Five.utilities.marker, line 84, in getAvailableInterfaceNames
Module Products.Five.utilities.marker, line 114, in _getInterfaceNames
Module zope.component.interface, line 127, in interfaceToName
AssertionError: Ambiguous interface names: ['plone.app.contentmenu.interfaces.IContentMenuItem', 'plone.app.contentmenu.interfaces.IContentMenuItem']
- Expression: "view/getAvailableInterfaceNames"
- Filename: ... y2.7.egg/Products/Five/utilities/browser/edit_markers.pt
- Location: (line 46: col 33)
- Source: ... repeat="interface view/getAvailableInterfaceNames">
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Arguments: repeat: {...} (0)
template: <ViewPageTemplateFile - at 0x7f59551c2490>
views: <ViewMapper - at 0x7f5950fc1150>
modules: <instance - at 0x7f59596f0758>
args: <tuple - at 0x7f5961f6a050>
here: <ImplicitAcquisitionWrapper Plone at 0x7f59543b2f50>
user: <ImplicitAcquisitionWrapper - at 0x7f5952a29cd0>
nothing: <NoneType - at 0x9014f0>
container: <ImplicitAcquisitionWrapper Plone at 0x7f59543b2f50>
request: <instance - at 0x7f5950d7e488>
wrapped_repeat: <SafeMapping - at 0x7f59538b0788>
traverse_subpath: <list - at 0x7f5950d7dd88>
default: <object - at 0x7f5961e8a530>
loop: {...} (1)
context: <ImplicitAcquisitionWrapper Plone at 0x7f59543b2f50>
view: <SimpleViewClass from /home/jensens/.buildout/shared-eggs/Zope2-2.13.26-py2.7.egg/Products/Five/utilities/browser/manage_interfaces.pt manage_interfaces at 0x7f5950fc17d0>
translate: <function translate at 0x7f5950f3d6e0>
root: <ImplicitAcquisitionWrapper Zope at 0x7f5952ac3820>
options: {...} (0)
target_language: <NoneType - at 0x9014f0>
I'm seening this too. It works with 5.1b3 but not with 5.1b4-pending
Apparently the same utility (plone.app.contentmenu.interfaces.IContentMenuItem) is registered under two names: 'plone.app.contentmenu.interfaces.IContentMenuItem' and 'plone_contentmenu'.
I don't think the problem comes from plone.app.contentmenu itself (we still get the error if we check out an older version).
I haven't found the problem, but the most meaningfull differences with 5.1b3 about this issue seem to be:
I did some digging but only found out that
searchInterfaceUtilities(
context = <Products.Five.utilities.marker.MarkerInterfacesAdapter object at 0x109339550>,
search_string = None,
base = <InterfaceClass plone.app.contentmenu.interfaces.IContentMenuItem>)
returns [] in 5.0b3 but 2 items in 5.0b4:
[(u'plone.app.contentmenu.interfaces.IContentMenuItem', <InterfaceClass plone.app.contentmenu.interfaces.IContentMenuItem>),
(u'plone_contentmenu', <InterfaceClass plone.app.contentmenu.interfaces.IContentMenuItem>)]
Maybe this is helpful for someone.
Also: When we ignore the line assert len(ids) == 1, "Ambiguous interface names: %s" % ids everything seems to work as expected. But I don't think that is a solution.
Pinning back zope.component to 3.12.1 works :)
Congrats to @ebrehault for guessing it right!
The commit causing the error is this one:
Probably @MrTango had a good reason for that upgrade (Python 3 compatibility?).
Once there was also a warning about not upgrading zope.component:
Thanks for the great work you are doing!
@ale-rt I am glad I could help :)
After spending hours pdb-ing without results, I was quite disappointed.
Pining back zope.component to 3.12.1 gives an error on sites already on 5.1b4
Traceback (most recent call last):
File "/home/vagrant/Eggs/Zope2-2.13.26-py2.7.egg/ZServer/PubCore/ZServerPublisher.py", line 31, in __init__
response=b)
File "/home/vagrant/Eggs/Zope2-2.13.26-py2.7.egg/ZPublisher/Publish.py", line 455, in publish_module
environ, debug, request, response)
File "/home/vagrant/Eggs/Zope2-2.13.26-py2.7.egg/ZPublisher/Publish.py", line 276, in publish_module_standard
if request is not None: request.close()
File "/home/vagrant/Eggs/Zope2-2.13.26-py2.7.egg/ZPublisher/BaseRequest.py", line 220, in close
notify(EndRequestEvent(None, self))
File "/home/vagrant/Eggs/zope.event-3.5.2-py2.7.egg/zope/event/__init__.py", line 31, in notify
subscriber(event)
File "/home/vagrant/Eggs/zope.component-3.12.1-py2.7.egg/zope/component/event.py", line 24, in dispatch
zope.component.subscribers(event, None)
File "/home/vagrant/Eggs/zope.component-3.12.1-py2.7.egg/zope/component/_api.py", line 136, in subscribers
return sitemanager.subscribers(objects, interface)
File "/home/vagrant/Eggs/zope.interface-4.4.0-py2.7-linux-x86_64.egg/zope/interface/registry.py", line 442, in subscribers
return self.adapters.subscribers(objects, provided)
File "/home/vagrant/Eggs/ZODB-5.2.4-py2.7.egg/ZODB/Connection.py", line 800, in setstate
self._reader.setGhostState(obj, p)
File "/home/vagrant/Eggs/ZODB-5.2.4-py2.7.egg/ZODB/serialize.py", line 623, in setGhostState
obj.__setstate__(state)
File "/home/vagrant/Eggs/zope.component-3.12.1-py2.7.egg/zope/component/persistentregistry.py", line 41, in __setstate__
self._v_lookup.changed(self)
File "/home/vagrant/Eggs/zope.interface-4.4.0-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 453, in changed
super(AdapterLookupBase, self).changed(None)
AttributeError: 'PersistentAdapterRegistry' object has no attribute 'ro'
Investing some more time I found the relevant difference:
In zope.component 3.12.1 the method zope.component.interface.searchInterfaceUtilities uses
[iface_util for iface_util in iface_utilities if iface_util[1].isOrExtends(base)]
in 4.3.0 is uses:
[iface_util for iface_util in iface_utilities if iface_util[1].extends(base)]
isOrExtends(base) returns the 2 items mentioned above, extends(base) returns [].
It is the change https://github.com/zopefoundation/zope.component/commit/2e39b26054c8c1da36886b7ba8ba0d346d62d2d7#diff-65de6b69a0342d33e93d0098ac38b46cL220 from 2012! Good night for now.
Also: With the old behavior (extends()) I could not find a single case (test or use of zmi) where interfaceToName actually returned any ids. Instead it always seemed to return interface.__module__ + '.' + interface.__name_
I discuss solutions to this in https://github.com/zopefoundation/zope.component/issues/32.
This is the pull-request that fixes this: https://github.com/zopefoundation/zope.component/pull/33
Fixed
Most helpful comment
This is the pull-request that fixes this: https://github.com/zopefoundation/zope.component/pull/33