Changeset 2996 in products
- Timestamp:
- Nov 11, 2010 10:29:06 AM (13 years ago)
- Location:
- quintagroup.plonegooglesitemaps/branches/blacklist/quintagroup/plonegooglesitemaps
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonegooglesitemaps/branches/blacklist/quintagroup/plonegooglesitemaps/browser/commonview.py
r2978 r2996 110 110 interface=IBlackoutFilter, name=fname) 111 111 if fengine: 112 objects = fengine.filterOut(objects, fargs)112 objects = list(fengine.filterOut(objects, fargs)) 113 113 return objects 114 114 -
quintagroup.plonegooglesitemaps/branches/blacklist/quintagroup/plonegooglesitemaps/filters.py
r2979 r2996 1 from itertools import ifilter 1 2 from zope.interface import implements 2 3 from zope.component import queryMultiAdapter 3 4 from quintagroup.plonegooglesitemaps.interfaces import IBlackoutFilter 5 4 6 5 7 class IdBlackoutFilter(object): … … 14 16 def filterOut(self, fdata, fargs): 15 17 """Filter-out fdata list by id in fargs.""" 16 for b in fdata: 17 if (b.getId or b.id) != fargs: 18 yield b 18 return ifilter(lambda b,fa=fargs:(b.getId or b.id) != fargs, 19 fdata) 19 20 20 21 … … 30 31 def filterOut(self, fdata, fargs): 31 32 """Filter-out fdata list by path in fargs.""" 32 if not (fargs.startswith("/") or fargs.startswith("./")):33 for b in fdata:34 yield b35 36 33 if fargs.startswith("/"): 37 34 # absolute path filter … … 39 36 name=u"plone_portal_state").portal().getId() 40 37 test_path = '/' + portal_id + fargs 41 el se:38 elif fargs.startswith("./"): 42 39 # relative path filter 43 40 container_path = '/'.join(self.context.getPhysicalPath()[:-1]) 44 41 test_path = container_path + fargs[1:] 42 else: 43 # unrecognized starting point 44 return fdata 45 45 46 for b in fdata: 47 if b.getPath() != test_path: 48 yield b 49 46 return ifilter(lambda b,tp=test_path: b.getPath() != tp, 47 fdata)
Note: See TracChangeset
for help on using the changeset viewer.