Back to index

plone3  3.1.7
Classes | Functions
CMFEditions.VersionPolicies Namespace Reference

Classes

class  VersionPolicy
class  ATVersionOnEditPolicy
class  DummyRequest

Functions

def add_form_controller_overrides
def remove_form_controller_overrides

Function Documentation

Definition at line 87 of file VersionPolicies.py.

00087 
00088 def add_form_controller_overrides(portal, actions):
00089     fc = getToolByName(portal, 'portal_form_controller', None)
00090     if fc is not None:
00091         for action in actions:
00092             fc.addFormAction(action['template'],
00093                         action['status'],
00094                         action['context'],
00095                         action['button'],
00096                         action['action'],
00097                         action['expression'])
00098 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 99 of file VersionPolicies.py.

00099 
00100 def remove_form_controller_overrides(portal, actions):
00101     fc = getToolByName(portal, 'portal_form_controller', None)
00102     # Fake a request because form controller needs one to delete actions
00103     fake_req = DummyRequest()
00104     i = 0
00105     for fc_act in fc.listFormActions(1):
00106         for action in actions:
00107             if (action['template'] == fc_act.getObjectId() and
00108                     action['status'] == fc_act.getStatus() and
00109                     action['context'] == fc_act.getContextType() and
00110                     action['button'] == fc_act.getButton() and
00111                     action['action'] == fc_act.getActionType() and
00112                     action['expression'] == fc_act.getActionArg()):
00113                 fake_req.form['del_id_%s'%i]=True
00114                 fake_req.form['old_object_id_%s'%i]=action['template'] or ''
00115                 fake_req.form['old_context_type_%s'%i]=action['context'] or ''
00116                 fake_req.form['old_button_%s'%i]=action['button'] or ''
00117                 fake_req.form['old_status_%s'%i]=action['status'] or ''
00118         i = i+1
00119     # Use the private method because the public one does a redirect
00120     fc._delFormActions(fc.actions,fake_req)
00121 
# Fake request class to satisfy formcontroller removal policy

Here is the call graph for this function:

Here is the caller graph for this function: