source: products/quintagroup.plonegooglesitemaps/branches/configurable_types_extending/quintagroup/plonegooglesitemaps/catalog.py

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

#131: Added 'access' and 'genres' tags support by News Sitemap

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1from zope.interface import Interface
2
3#for compatibility with older plone versions
4try:
5    from plone.indexer.decorator import indexer
6    IS_NEW = True
7except:
8    IS_NEW = False
9    class IDummyInterface:pass
10    class indexer:
11
12         def __init__(self, *interfaces):
13            self.interfaces = IDummyInterface,
14
15         def __call__(self, callable):
16             callable.__component_adapts__ = self.interfaces
17             callable.__implemented__ = Interface
18             return callable
19   
20@indexer(Interface)
21def gsm_access(obj, **kwargs):
22    """Return value for access tag for Google's News Sitemaps.
23    """
24    return obj.getProperty("gsm_access", "")
25
26@indexer(Interface)
27def gsm_genres(obj, **kwargs):
28    """Return value for genres tag for Google's News Sitemaps.
29    """
30    return obj.getProperty("gsm_genres", "")
31
32
33#for compatibility with older plone versions
34if not IS_NEW:
35    from Products.CMFPlone.CatalogTool import registerIndexableAttribute
36    map(registerIndexableAttribute, ('gsm_access', 'gsm_genres'),
37                                    (gsm_access, gsm_genres))
Note: See TracBrowser for help on using the repository browser.