source: products/quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/newssitemapview.py @ 2396

Last change on this file since 2396 was 2396, checked in by mylan, 14 years ago

#131: Update news sitemap with new required tags

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1import re
2from DateTime import DateTime
3from commonview import *
4from zope.component import getMultiAdapter
5
6reTrailingParenthtical = re.compile("\s*\(.*\)\s*", re.S)
7
8class NewsSitemapView(CommonSitemapView):
9    """
10    News Sitemap browser view
11    """
12    implements(ISitemapView)
13
14    additional_maps = (
15        ('publication_date', lambda x:DateTime(x.EffectiveDate).strftime("%Y-%m-%d")),
16        ('keywords', lambda x:', '.join(x.Subject)),
17        ('name', lambda x:reTrailingParenthtical.sub("",x.Title)),
18        ('title', lambda x:x.Title),
19        ('language', lambda x:x.Language),
20    )
21
22    def getFilteredObjects(self):
23        path = self.portal.getPhysicalPath()
24        portal_types = self.context.getPortalTypes()
25        review_states = self.context.getStates()
26        min_date = DateTime() - 3
27        res = self.portal_catalog(path = path,
28                portal_type = portal_types,
29                review_state = review_states,
30                effective = {"query": min_date,
31                             "range": "min" })
32        return res
Note: See TracBrowser for help on using the repository browser.