Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
plone.app.iterate.policy.CheckinCheckoutPolicyAdapter Class Reference
Collaboration diagram for plone.app.iterate.policy.CheckinCheckoutPolicyAdapter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def checkout
def checkin
def cancelCheckout

Public Attributes

 context

Static Public Attributes

string default_base_message = "Created Baseline"

Private Member Functions

def _getBaseline
 Checkin Support Methods.

Detailed Description

Default Checkin Checkout Policy For Content

on checkout context is the baseline

on checkin context is the working copy

Definition at line 41 of file policy.py.


Constructor & Destructor Documentation

Definition at line 56 of file policy.py.

00056 
00057     def __init__( self, context ):
00058         self.context = context

Here is the caller graph for this function:


Member Function Documentation

Checkin Support Methods.

Definition at line 112 of file policy.py.

00112 
00113     def _getBaseline( self ):
00114         # follow the working copy's reference back to the baseline
00115         refs = self.context.getRefs( WorkingCopyRelation.relationship )
00116 
00117         if not len(refs) == 1:
00118             raise interfaces.CheckinException( "Baseline count mismatch" )
00119 
00120         if not refs or refs[0] is None:
00121             raise interfaces.CheckinException( "Baseline has disappeared" )
00122 
00123         baseline = refs[0]
        return baseline

Here is the caller graph for this function:

Definition at line 94 of file policy.py.

00094 
00095     def cancelCheckout( self ):
00096         # see interface
00097         
00098         # get the baseline
00099         baseline = self._getBaseline()
00100 
00101         # publish an event
00102         notify( event.CancelCheckoutEvent( self.context, baseline ) )
00103         
00104         # delete the working copy        
00105         wc_container =  aq_parent( aq_inner( self.context ) )
00106         wc_container.manage_delObjects( [ self.context.getId() ] )
00107 
00108         return baseline

Here is the call graph for this function:

Definition at line 73 of file policy.py.

00073 
00074     def checkin( self, checkin_message ):
00075         # see interface
00076 
00077         # get the baseline for this working copy, raise if not found
00078         baseline = self._getBaseline()
00079 
00080         # get a hold of the relation object
00081         wc_ref = self.context.getReferenceImpl( WorkingCopyRelation.relationship )[ 0]
00082         
00083         # publish the event for subscribers, early because contexts are about to be manipulated
00084         notify( event.CheckinEvent( self.context, baseline, wc_ref, checkin_message ) )
00085 
00086         # merge the object back to the baseline with a copier
00087         copier = component.queryAdapter( self.context, interfaces.IObjectCopier )
00088         new_baseline = copier.merge()
00089 
00090         # don't need to unlock the lock disappears with old baseline deletion
00091         notify( event.AfterCheckinEvent( new_baseline, checkin_message ) )
00092         
00093         return new_baseline

Here is the call graph for this function:

Definition at line 59 of file policy.py.

00059 
00060     def checkout( self, container ):
00061         # see interface
00062         notify( event.BeforeCheckoutEvent( self.context ) )
00063 
00064         # use the object copier to checkout the content to the container
00065         copier = component.queryAdapter( self.context, interfaces.IObjectCopier )
00066         working_copy, relation = copier.copyTo( container )
00067 
00068         # publish the event for any subscribers
00069         notify( event.CheckoutEvent( self.context, working_copy, relation ) )
00070        
00071         # finally return the working copy 
00072         return working_copy


Member Data Documentation

Definition at line 57 of file policy.py.

Definition at line 54 of file policy.py.


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