Comment 1 for bug 1202879

Revision history for this message
Darryl Dixon (esrever-otua) wrote :

An example of a working version of the affected function would be:

def icon(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.
    """
    utool = getToolByName(self, 'portal_url')
    portal_url = utool()
    icon = self.getIconURL()
    if portal_url:
        if icon.startswith(portal_url):
            icon = icon[len(portal_url):]
            while icon.startswith('/'):
                icon = icon[1:]
            if not relative_to_portal:
                # Relative to REQUEST['BASEPATH1']
                icon = '%s/%s' % (utool(relative=1), icon)
    return icon