Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
CMFEditions.tests.DummyTools.DummyPurgePolicy Class Reference
Inheritance diagram for CMFEditions.tests.DummyTools.DummyPurgePolicy:
Inheritance graph
[legend]
Collaboration diagram for CMFEditions.tests.DummyTools.DummyPurgePolicy:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def beforeSaveHook
def retrieveSubstitute
def getId

Static Public Attributes

string id = 'portal_purgepolicy'

Static Private Attributes

 __implements__ = IPurgePolicy

Detailed Description

Dummy Purge Policy

Definition at line 601 of file DummyTools.py.


Member Function Documentation

def CMFEditions.tests.DummyTools.DummyPurgePolicy.beforeSaveHook (   self,
  history_id,
  obj,
  metadata = {} 
)
Purge old versions

Purges old version so that at maximum two versions reside in 
the history.

Definition at line 607 of file DummyTools.py.

00607 
00608     def beforeSaveHook(self, history_id, obj, metadata={}):
00609         """Purge old versions
00610         
00611         Purges old version so that at maximum two versions reside in 
00612         the history.
00613         """
00614         storage = getToolByName(self, 'portal_historiesstorage')
00615         currentVersion = len(storage.getHistory(history_id))
00616         while True:
00617             length = len(storage.getHistory(history_id, countPurged=False))
00618             if length < 2:
00619                 break
00620             comment = "purged on save of version %s" % currentVersion
00621             metadata = {"sys_metadata": {"comment": comment}}
00622             storage.purge(history_id, 0, metadata, countPurged=False)
00623         
00624         return True
    

Here is the call graph for this function:

Definition at line 33 of file DummyTools.py.

00033 
00034     def getId(self):
00035         return self.id

Here is the call graph for this function:

def CMFEditions.tests.DummyTools.DummyPurgePolicy.retrieveSubstitute (   self,
  history_id,
  selector,
  default = None 
)
Retrives the next older version

Definition at line 625 of file DummyTools.py.

00625 
00626     def retrieveSubstitute(self, history_id, selector, default=None):
00627         """Retrives the next older version
00628         """
00629         storage = getToolByName(self, 'portal_historiesstorage')
00630         while selector:
00631             selector -= 1
00632             data = storage.retrieve(history_id, selector, substitute=False)
00633             if data.isValid():
00634                 return data
00635         return default
00636 

Here is the call graph for this function:


Member Data Documentation

Definition at line 604 of file DummyTools.py.

string CMFEditions.tests.DummyTools.DummyPurgePolicy.id = 'portal_purgepolicy' [static]

Definition at line 605 of file DummyTools.py.


The documentation for this class was generated from the following file: