Changeset 2751 in products for quintagroup.plonegooglesitemaps


Ignore:
Timestamp:
Aug 13, 2010 1:12:41 PM (14 years ago)
Author:
mylan
Message:

#229: Fixed gsm_gentres, title, publication_date (replace EffectiveDate? to Date brain) data calculation for news sitemap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/newssitemapview.py

    r2742 r2751  
    66 
    77reTrailingParenthtical = re.compile("\s*\(.*\)\s*", re.S) 
     8 
     9formatDate = lambda d:DateTime(d).strftime("%Y-%m-%d") 
    810 
    911class NewsSitemapView(CommonSitemapView): 
     
    1517    @property 
    1618    def additional_maps(self): 
     19         
    1720        return ( 
    18             ('publication_date', lambda x:DateTime(x.EffectiveDate).strftime("%Y-%m-%d")), 
    19             ('keywords', lambda x:', '.join(x.Subject)), 
     21            ('publication_date', lambda x:x.Date and formatDate(x.Date) or ""), 
     22            ('keywords', lambda x:x.Subject and ', '.join(x.Subject) or ""), 
    2023            ('title', lambda x:x.Title or x.getId or x.id), 
    21             ('name', lambda x:reTrailingParenthtical.sub("",x.Title)), 
     24            ('name', lambda x:x.Title and reTrailingParenthtical.sub("",x.Title) or ""), 
    2225            ('language', lambda x:x.Language or self.default_language()), 
    2326            ('access', lambda x:x.gsm_access or ""), 
    24             ('genres', lambda x:x and ", ".join(x.gsm_genres) or ""), 
     27            ('genres', lambda x:x.gsm_genres and ", ".join(x.gsm_genres) or ""), 
    2528            ('stock', lambda x:x.gsm_stock or ""), 
    2629        ) 
Note: See TracChangeset for help on using the changeset viewer.