Exemplo n.º 1
0
 def migrateTrackbacksForEntry(self, entry):
     """Swap to multiple trackback URLs stored with an adapter.
     """
     if not hasattr(entry, 'trackbackURLs'):
         # The attribute doesn't exist anymore so nothing to
         # migrate!
         return
     # Adapt to the interface for storing trackback details
     tbim = ITrackbackOutManager(entry)
     # Get the existing URLs by attribute access as the methods are no longer
     # available - the schema no longer defines them.
     urls = getattr(entry, 'trackbackURLs', None)
     if urls:
         #print >> self.out, \
         #    u"Migrating trackbacks for %s." % "/".join(entry.getPhysicalPath())
         wftool = getToolByName(entry, 'portal_workflow')
         review_state = wftool.getInfoFor(entry, 'review_state')
         if review_state == 'published':
             # If the entry is published, the URLs will already have been pinged
             tbim.setPingedURLs(urls)
         else:
             # ... otherwise, they still need to be pinged.
             tbim.setURLsToPing(urls)
     # Remove the attribute.
     del entry.trackbackURLs
Exemplo n.º 2
0
 def migrateTrackbacksForEntry(self, entry):
     """Swap to multiple trackback URLs stored with an adapter.
     """
     if not hasattr(entry, 'trackbackURLs'):
         # The attribute doesn't exist anymore so nothing to
         # migrate!
         return
     # Adapt to the interface for storing trackback details
     tbim = ITrackbackOutManager(entry)
     # Get the existing URLs by attribute access as the methods are no longer
     # available - the schema no longer defines them.
     urls = getattr(entry, 'trackbackURLs', None)
     if urls:
         #print >> self.out, \
         #    u"Migrating trackbacks for %s." % "/".join(entry.getPhysicalPath())
         wftool = getToolByName(entry, 'portal_workflow')
         review_state = wftool.getInfoFor(entry, 'review_state')
         if review_state == 'published':
             # If the entry is published, the URLs will already have been pinged
             tbim.setPingedURLs(urls)
         else:
             # ... otherwise, they still need to be pinged.
             tbim.setURLsToPing(urls)
     # Remove the attribute.
     del entry.trackbackURLs