[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/DynamicType.py - made sure we always can access the setup tool and run the upgrade step

Yvo Schubbe y.2011 at wcm-solutions.de
Wed Sep 14 08:21:07 EST 2011


Log message for revision 122806:
  - made sure we always can access the setup tool and run the upgrade step

Changed:
  U   Products.CMFCore/trunk/Products/CMFCore/DynamicType.py

-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/DynamicType.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/DynamicType.py	2011-09-14 12:31:04 UTC (rev 122805)
+++ Products.CMFCore/trunk/Products/CMFCore/DynamicType.py	2011-09-14 13:21:07 UTC (rev 122806)
@@ -14,9 +14,11 @@
 """
 
 from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import aq_get
 from App.class_init import InitializeClass
 from zope.component import getUtility
 from zope.component import queryMultiAdapter
+from zope.component.interfaces import ComponentLookupError
 from zope.interface import implements
 from zope.publisher.defaultview import queryDefaultViewName
 
@@ -109,7 +111,11 @@
         creator to grab icons on the fly instead of using a fixed
         attribute on the class.
         """
-        utool = getUtility(IURLTool)
+        try:
+            utool = getUtility(IURLTool)
+        except ComponentLookupError:
+            # BBB: fallback for CMF 2.2 instances
+            utool = aq_get(self, 'portal_url')
         portal_url = utool()
         icon = self.getIconURL()
         if icon.startswith(portal_url):



More information about the checkins mailing list