+
+
+# monkey-patch de getIcon qui est foirasse dans CMF2.2 :
+# les icônes ne s'affichent pas correctement dans la ZMI
+# lorqu'on y accède par un virtual host apache.
+from urllib import quote
+from Products.CMFCore.utils import getToolByName
+
+def getIcon(self, relative_to_portal=0):
+ """
+ Using this method allows the content class
+ creator to grab icons on the fly instead of using a fixed
+ attribute on the class.
+ """
+ ti = self.getTypeInfo()
+ if ti is not None:
+ icon = quote(ti.getIcon())
+ if icon:
+ if relative_to_portal:
+ return icon
+ else:
+ # Relative to REQUEST['BASEPATH1']
+ portal_url = getToolByName( self, 'portal_url' )
+ res = portal_url(relative=1) + '/' + icon
+ while res[:1] == '/':
+ res = res[1:]
+ return res
+ return 'misc_/OFSP/dtmldoc.gif'
+
+icon = getIcon # For the ZMI
+
+from Products.CMFCore.DynamicType import DynamicType
+DynamicType.getIcon = getIcon
+DynamicType.icon = getIcon