source: products/qPloneGoogleSitemaps/trunk/handlers.py @ 458

Last change on this file since 458 was 458, checked in by fenix, 14 years ago

qPloneResolveUID import

  • Property svn:eol-style set to native
File size: 916 bytes
RevLine 
[414]1from zope.component import adapter
2from Products.CMFCore.utils import getToolByName
[448]3#from Products.qPloneGoogleSitemaps.events import AfterTransitionEvent
[414]4from Products.qPloneGoogleSitemaps.interfaces import IAfterTransitionEvent
5from Products.qPloneGoogleSitemaps.utils import ping_google
6
[448]7@adapter(IAfterTransitionEvent)
8def pingGoogle(event):
[414]9    object = event.object
[448]10    catalog = getToolByName(object, 'portal_catalog')
[443]11
[448]12    sitemaps = [b.getObject() for b in catalog(portal_type='Sitemap')]
13    if sitemaps:
14        plone_home = getToolByName(object, 'portal_url').getPortalObject().absolute_url()
[414]15        wftrans_name = "%s#%s" % (event.workflow.id, event.transition.id)
[454]16        obj_ptype = object.portal_type
[448]17        for sm in sitemaps:
[454]18            if wftrans_name in sm.getPingTransitions() \
19               and obj_ptype in sm.getPortalTypes():
[448]20                ping_google(plone_home, sm.id)
[414]21    return 0
Note: See TracBrowser for help on using the repository browser.