Changeset 2923 in products


Ignore:
Timestamp:
Oct 25, 2010 2:38:55 PM (14 years ago)
Author:
mylan
Message:

#228: Fixed default Path filter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/branches/blacklist/quintagroup/plonegooglesitemaps/utilities.py

    r2922 r2923  
    11from zope.interface import implements 
     2from zope.component import queryMultiAdapter 
    23from quintagroup.plonegooglesitemaps.interfaces import IBlackoutFilterUtility 
    34 
     
    1920    def filterOut(self, fdata, fkey, **kwargs): 
    2021        """Filter-out fdata list by path in fkey.""" 
     22        sm = kwargs.get("sitemap", None) 
     23        req = kwargs.get("request", None) 
    2124        if fkey.startswith("/"): 
    2225            # absolute path filter 
    23             return [b for b in fdata if b.getPath() != fkey] 
     26            # portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') 
     27            portal = queryMultiAdapter((sm, req), name=u"plone_portal_state").portal() 
     28            return [b for b in fdata if b.getPath() != '/%s%s' % (portal.getId(), fkey)] 
    2429        elif fkey.startswith("./"): 
    2530            # relative path filter 
    26             smpath = kwargs.get("sitemap") 
    27             contpath = '/'.join(smpath.getPhysicalPath()[:-1]) 
    28             resfilter = contpath + fkey[1:] 
    29             return [b for b in fdata if b.getPath() != resfilter] 
     31            contpath = '/'.join(sm.getPhysicalPath()[:-1]) 
     32            return [b for b in fdata if b.getPath() != (contpath + fkey[1:])] 
    3033        return fdata 
Note: See TracChangeset for help on using the changeset viewer.