Commit 03068353 authored by Tomáš Peterka's avatar Tomáš Peterka

Non-existing CallableTool does not bring down the portal

In my case, non-existing CallableTool did not raise 'AttributeError'
but went to acquisition chain loop thus failed on recursion error.

Seems that test on 'hasattr' does not get into such a loop.
parent f4e03d67
...@@ -53,7 +53,7 @@ def CMFCoreSkinnableSkinnableObjectManager_initializeCache(self): ...@@ -53,7 +53,7 @@ def CMFCoreSkinnableSkinnableObjectManager_initializeCache(self):
if portal_skins is None: if portal_skins is None:
return return
portal_skins = portal_skins.aq_base portal_skins = portal_skins.aq_base
portal_callables = getattr(self, 'portal_callables', None) portal_callables = getattr(self, 'portal_callables', None) if hasattr(self, 'portal_callables') else None
if portal_callables is not None: if portal_callables is not None:
portal_callables = portal_callables.aq_base portal_callables = portal_callables.aq_base
skin_selection_mapping = {} skin_selection_mapping = {}
...@@ -71,7 +71,8 @@ def skinResolve(self, selection, name): ...@@ -71,7 +71,8 @@ def skinResolve(self, selection, name):
except AttributeError: except AttributeError:
raise AttributeError, name raise AttributeError, name
try: try:
portal_callables = aq_base(self.portal_callables) if hasattr(self, 'portal_callables') and hasattr(self.portal_callables, 'aq_base'):
portal_callables = aq_base(self.portal_callables)
except AttributeError: except AttributeError:
# backwards compatability for ERP5 sites without this tool # backwards compatability for ERP5 sites without this tool
portal_callables = None portal_callables = None
......
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