Back to index

plone3  3.1.7
Public Member Functions | Private Attributes | Static Private Attributes
CMFEditions.ArchivistTool.LazyHistory Class Reference

List of all members.

Public Member Functions

def __init__
def __len__
def __getitem__
def __iter__

Private Attributes

 _modifier
 _preserve
 _history

Static Private Attributes

tuple __implements__ = (IHistory, )

Detailed Description

Lazy history.

Definition at line 419 of file ArchivistTool.py.


Constructor & Destructor Documentation

def CMFEditions.ArchivistTool.LazyHistory.__init__ (   self,
  archivist,
  obj,
  history_id,
  preserve,
  countPurged 
)
Sets up a lazy history. 

Takes an object which should be the original object in the portal, 
and a history_id for the storage lookup. If the history id is 
omitted then the history_id will be determined by dereferencing 
the obj. If the obj is omitted, then the obj will be obtained by 
dereferencing the history_id.

Definition at line 424 of file ArchivistTool.py.

00424 
00425     def __init__(self, archivist, obj, history_id, preserve, countPurged):
00426         """Sets up a lazy history. 
00427         
00428         Takes an object which should be the original object in the portal, 
00429         and a history_id for the storage lookup. If the history id is 
00430         omitted then the history_id will be determined by dereferencing 
00431         the obj. If the obj is omitted, then the obj will be obtained by 
00432         dereferencing the history_id.
00433         """
00434         self._modifier = getToolByName(archivist, 'portal_modifier')
00435         storage = getToolByName(archivist, 'portal_historiesstorage')
00436         self._obj, history_id = dereference(obj, history_id, archivist)
00437         self._preserve = preserve
00438         self._history = storage.getHistory(history_id, countPurged)
        

Member Function Documentation

def CMFEditions.ArchivistTool.LazyHistory.__getitem__ (   self,
  selector 
)
See IHistory

Definition at line 444 of file ArchivistTool.py.

00444 
00445     def __getitem__(self, selector):
00446         """See IHistory
00447         """
00448         # To retrieve an object from the storage the following
00449         # steps have to be carried out:
00450         #
00451         # 1. get the appropriate data from the storage
00452         vdata = self._history[selector]
00453         
00454         # 2. clone the data and add the version id
00455         data = deepcopy(vdata.object)
00456         repo_clone = aq_base(data.object)
00457         
00458         # 3. the separately saved attributes need not be cloned
00459         referenced_data = vdata.referenced_data
00460         
00461         # 4. clone the metadata
00462         metadata = deepcopy(vdata.metadata)
00463         
00464         # 5. reattach the separately saved attributes
00465         self._modifier.reattachReferencedAttributes(repo_clone, 
00466                                                     referenced_data)
00467         
00468         # 6. call the after retrieve modifier
00469         refs_to_be_deleted, attr_handling_references, preserved_data = \
00470             self._modifier.afterRetrieveModifier(self._obj, repo_clone, 
00471                                                  self._preserve)
00472         
00473         return VersionData(data, refs_to_be_deleted, 
00474                            attr_handling_references, preserved_data, 
00475                            metadata)

Here is the call graph for this function:

Here is the caller graph for this function:

See IHistory.

Definition at line 476 of file ArchivistTool.py.

00476 
00477     def __iter__(self):
00478         """See IHistory.
00479         """
00480         return GetItemIterator(self.__getitem__,
00481                                stopExceptions=(StorageRetrieveError,))
00482 

Here is the call graph for this function:

Here is the caller graph for this function:

See IHistory

Definition at line 439 of file ArchivistTool.py.

00439 
00440     def __len__(self):
00441         """See IHistory
00442         """
00443         return len(self._history)
    

Member Data Documentation

tuple CMFEditions.ArchivistTool.LazyHistory.__implements__ = (IHistory, ) [static, private]

Definition at line 422 of file ArchivistTool.py.

Definition at line 437 of file ArchivistTool.py.

Definition at line 433 of file ArchivistTool.py.

Definition at line 436 of file ArchivistTool.py.


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