Logo Search packages:      
Sourcecode: zope-cachefu version File versions  Download package

def CMFSquidTool::SquidTool::SquidTool::getUrlsToPurge (   self,
  object 
)

Return the URLs to purge when an object is modified

Definition at line 124 of file SquidTool.py.

00124                                     :
        """Return the URLs to purge when an object is modified
        """
        if (self.url_expression is None or
            not self.getUrlExpression().strip()):
            portal_url = getToolByName(self, 'portal_url')
            # No url expression, short-circuit.
            paths = [portal_url.getRelativeUrl(object)]
        else:
            context = createUrlExpressionContext(object)
            try:
                paths = self.url_expression(context)
            except ConflictError:
                raise
            except:
                paths = []
                logger.exception('Exception computing urls to purge.')

        # Now some special handling for elements inside portal_skins.
        st = getToolByName(object, 'portal_skins', None)
        if st is None:
            return paths
        sn = st.getSkinNameFromRequest(
            REQUEST=getattr(object, 'REQUEST', None))
        if sn is None:
            sn = st.getDefaultSkin()
        sp = st.getSkinPath(sn)
        if sp is None or sp == sn:
            return paths
        skin_paths = [s.strip() for s in sp.split(',')]
        skin_paths = filter(None, skin_paths)
        for path in paths[:]:
            if skins_re.search(path) is None:
                continue
            orig_path = path
            for sub in skin_paths:
                path = orig_path.replace('portal_skins/%s/' % sub, '')
                if path != orig_path and path not in paths:
                    paths.append(path)
        return paths

    security.declareProtected(PURGE_URL, 'pruneObject')
    def pruneObject(self, ob, purge_type='PURGE', REQUEST=None):


Generated by  Doxygen 1.6.0   Back to index