def _has_graveyard_permit(self, replacement_rd3, replacement_rd3_info, graveyard, existing_gravestones): grantPermit = False numPlugins = LRPluginManager.getPluginCount(ITombstonePolicy.ID) for num, plugin in enumerate(LRPluginManager.getPlugins(ITombstonePolicy.ID), 1): try: grantPermit = grantPermit | plugin.permit_burial(replacement_rd3, replacement_rd3_info, graveyard) except Exception, e: log.exception("Plugin raised exception: %s", e) grantPermit = False if grantPermit or num == numPlugins: break
def _check_if_permitted(self, replacement_rd3, replacement_rd3_info, orig_doc, orig_doc_info): # if no tombstone policy plugins are active, permit a tombstone to be created if LRPluginManager.getPluginCount(ITombstonePolicy.ID) == 0: return True # Loop through all of our policy plugins to see if any we are permitted to # create a tombstone for our replacement doc allowTombstone = False for plugin in LRPluginManager.getPlugins(ITombstonePolicy.ID): try: checkPermit = plugin.permit(orig_doc, orig_doc_info, replacement_rd3, replacement_rd3_info) except DoNotPublishError, e: raise e except Exception, e: log.exception("Plugin '%s' raised exception: %s", plugin.__class__.__name__, e) checkPermit = False
def _has_graveyard_permit(self, replacement_rd3, replacement_rd3_info, graveyard, existing_gravestones): # if no tombstone policy plugins are active, permit a graveyard to be buried if LRPluginManager.getPluginCount(ITombstonePolicy.ID) == 0: return True # Loop through our policy plugins to see if any we are permitted to bury a graveyard of tombstones allowBurial = False for plugin in LRPluginManager.getPlugins(ITombstonePolicy.ID): try: grantPermit = plugin.permit_burial(replacement_rd3, replacement_rd3_info, graveyard) except Exception, e: log.exception("Plugin '%s' raised exception: %s", plugin.__class__.__name__, e) grantPermit = False allowBurial = allowBurial | grantPermit # once we find the first policy that grants us burial, go for it if allowBurial: break
def _check_if_permitted(self, replacement_rd3, replacement_rd3_info, orig_doc, orig_doc_info): # Tombstone logic needs to happen here # import pdb; pdb.set_trace() allowTombstone = True for plugin in LRPluginManager.getPlugins(ITombstonePolicy.ID): try: allowTombstone = allowTombstone & plugin.permit(orig_doc, orig_doc_info, replacement_rd3, replacement_rd3_info) except DoNotPublishError, e: raise e except Exception, e: log.exception("Plugin raised exception: %s", e) allowTombstone = False