Commit 4ba4c5ff authored by Jérome Perrin's avatar Jérome Perrin Committed by Kazuhiko Shiozaki

ERP5Site: unregister the portal as ISiteRoot utility

Some old ERP5 site were registered as ISiteRoot and this cause
issues with Products.CMFCore update 2.2.10 -> 2.7
parent 53f3a82c
...@@ -486,6 +486,16 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook ...@@ -486,6 +486,16 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook
setSite(old_site) setSite(old_site)
else: else:
self._registerMissingTools() self._registerMissingTools()
# Some old ERP5 Sites have ISiteRoot registered, which
# makes URLTool.getPortalObject() returns the portal in
# an incorrect acquisition context. We unregister this
# interface to have the fallback behavior from
# https://github.com/zopefoundation/Products.CMFCore/blob/c2b800e6/src/Products/CMFCore/URLTool.py#L75-L77
from Products.CMFCore.interfaces import ISiteRoot
if _components.unregisterUtility(provided=ISiteRoot):
LOG('ERP5Site', 0, 'Unregistered ISiteRoot Utility')
return _components return _components
security.declareProtected(Permissions.View, 'view') security.declareProtected(Permissions.View, 'view')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment