Back to index

plone3  3.1.7
Public Member Functions | Static Private Attributes
CMFEditions.StandardModifiers.RetainWorkflowStateAndHistory Class Reference

List of all members.

Public Member Functions

def beforeSaveModifier
def afterRetrieveModifier

Static Private Attributes

tuple __implements__ = (ISaveRetrieveModifier, )

Detailed Description

Standard modifier retaining the working copies workflow state

Avoids the objects workflow state from beeing retrieved also.

Definition at line 479 of file StandardModifiers.py.


Member Function Documentation

def CMFEditions.StandardModifiers.RetainWorkflowStateAndHistory.afterRetrieveModifier (   self,
  obj,
  repo_clone,
  preserve = () 
)

Definition at line 503 of file StandardModifiers.py.

00503 
00504     def afterRetrieveModifier(self, obj, repo_clone, preserve=()):
00505         # check if the modifier is called with a valid working copy
00506         if obj is None:
00507             return [], [], {}
00508 
00509         # replace the workflow stuff of the repository clone by the
00510         # one of the working copy or delete it
00511         if getattr(aq_base(obj), 'review_state', _marker) is not _marker:
00512             repo_clone.review_state = obj.review_state
00513         elif (getattr(aq_base(repo_clone), 'review_state', _marker)
00514               is not _marker):
00515             del repo_clone.review_state
00516 
00517         if getattr(aq_base(obj), 'workflow_history', _marker) is not _marker:
00518             repo_clone.workflow_history = obj.workflow_history
00519         elif (getattr(aq_base(repo_clone), 'workflow_history', _marker)
00520               is not _marker):
00521             del repo_clone.workflow_history
00522 
00523         return [], [], {}
00524 
00525 InitializeClass(RetainWorkflowStateAndHistory)

Definition at line 487 of file StandardModifiers.py.

00487 
00488     def beforeSaveModifier(self, obj, clone):
00489         # Saving the ``review_state`` as this is hard to achieve at retreive
00490         # (or because I'm dumb). What happened is that ``getInfoFor`` always
00491         # returned the state of the working copy although the retrieved 
00492         # temporary object was passed to it.
00493         #
00494         # Anyway the review state may be a very interesting piece of 
00495         # information for a hypothetic purge policy ...
00496         wflow = getToolByName(obj, "portal_workflow", None)
00497         if wflow is not None:
00498             review_state = wflow.getInfoFor(obj, "review_state", None)
00499         else:
00500             review_state = None
00501         
00502         return {"review_state": review_state}, [], []

Here is the call graph for this function:


Member Data Documentation

tuple CMFEditions.StandardModifiers.RetainWorkflowStateAndHistory.__implements__ = (ISaveRetrieveModifier, ) [static, private]

Definition at line 485 of file StandardModifiers.py.


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