Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
CMFCore.WorkflowTool.WorkflowTool Class Reference
Inheritance diagram for CMFCore.WorkflowTool.WorkflowTool:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.WorkflowTool.WorkflowTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def manage_selectWorkflows
def manage_changeWorkflows
def listActions
def getCatalogVariablesFor
def doActionFor
def getInfoFor
def notifyCreated
def notifyBefore
def notifySuccess
def notifyException
def getHistoryOf
def getStatusOf
def setStatusOf
def setDefaultChain
def setChainForPortalTypes
def getDefaultChain
def listChainOverrides
def getChainFor
def updateRoleMappings
def getWorkflowById
def getDefaultChainFor
def getWorkflowIds
def getWorkflowsFor

Static Public Attributes

string id = 'portal_workflow'
string meta_type = 'CMF Workflow Tool'
tuple security = ClassSecurityInfo()
tuple manage_options
tuple manage_overview = DTMLFile( 'explainWorkflowTool', _dtmldir )

Private Member Functions

def _listTypeInfo
def _invokeWithNotification
def _recursiveUpdateRoleMappings
def _setDefaultCataloging
def _reindexWorkflowVariables

Private Attributes

 _default_chain
 _default_cataloging

Static Private Attributes

tuple __implements__ = (z2IWorkflowTool, ActionProviderBase.__implements__)
tuple _product_interfaces = (IWorkflowDefinition,)
 _chains_by_type = None
tuple _default_chain = ('default_workflow',)
int _default_cataloging = 1
tuple _manage_selectWorkflows = DTMLFile('selectWorkflows', _dtmldir)

Detailed Description

Mediator tool, mapping workflow objects

Definition at line 53 of file WorkflowTool.py.


Member Function Documentation

def CMFCore.WorkflowTool.WorkflowTool._invokeWithNotification (   self,
  wfs,
  ob,
  action,
  func,
  args,
  kw 
) [private]
Private utility method:  call 'func', and deal with exceptions
    indicating that the object has been deleted or moved.

Definition at line 545 of file WorkflowTool.py.

00545 
00546     def _invokeWithNotification(self, wfs, ob, action, func, args, kw):
00547 
00548         """ Private utility method:  call 'func', and deal with exceptions
00549             indicating that the object has been deleted or moved.
00550         """
00551         reindex = 1
00552         for w in wfs:
00553             w.notifyBefore(ob, action)
00554             notify(ActionWillBeInvokedEvent(ob, w, action))
00555         try:
00556             res = func(*args, **kw)
00557         except ObjectDeleted, ex:
00558             res = ex.getResult()
00559             reindex = 0
00560         except ObjectMoved, ex:
00561             res = ex.getResult()
00562             ob = ex.getNewObject()
00563         except:
00564             exc = sys.exc_info()
00565             try:
00566                 for w in wfs:
00567                     w.notifyException(ob, action, exc)
00568                     notify(ActionRaisedExceptionEvent(ob, w, action, exc))
00569                 raise exc[0], exc[1], exc[2]
00570             finally:
00571                 exc = None
00572         for w in wfs:
00573             w.notifySuccess(ob, action, res)
00574             notify(ActionSucceededEvent(ob, w, action, res))
00575         if reindex:
00576             self._reindexWorkflowVariables(ob)
00577         return res

Here is the call graph for this function:

Here is the caller graph for this function:

List the portal types which are available.

Definition at line 532 of file WorkflowTool.py.

00532 
00533     def _listTypeInfo(self):
00534 
00535         """ List the portal types which are available.
00536         """
00537         # XXX: this method violates the rules for tools/utilities:
00538         # it depends on a non-utility tool
00539         pt = getToolByName(self, 'portal_types', None)
00540         if pt is None:
00541             return ()
00542         else:
00543             return pt.listTypeInfo()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.WorkflowTool.WorkflowTool._recursiveUpdateRoleMappings (   self,
  ob,
  wfs 
) [private]
Update roles-permission mappings recursively, and
    reindex special index.

Definition at line 579 of file WorkflowTool.py.

00579 
00580     def _recursiveUpdateRoleMappings(self, ob, wfs):
00581 
00582         """ Update roles-permission mappings recursively, and
00583             reindex special index.
00584         """
00585         # Returns a count of updated objects.
00586         count = 0
00587         wf_ids = self.getChainFor(ob)
00588         if wf_ids:
00589             changed = 0
00590             for wf_id in wf_ids:
00591                 wf = wfs.get(wf_id, None)
00592                 if wf is not None:
00593                     did = wf.updateRoleMappingsFor(ob)
00594                     if did:
00595                         changed = 1
00596             if changed:
00597                 count = count + 1
00598                 if hasattr(aq_base(ob), 'reindexObject'):
00599                     # Reindex security-related indexes
00600                     try:
00601                         ob.reindexObject(idxs=['allowedRolesAndUsers'])
00602                     except TypeError:
00603                         # Catch attempts to reindex portal_catalog.
00604                         pass
00605         if hasattr(aq_base(ob), 'objectItems'):
00606             obs = ob.objectItems()
00607             if obs:
00608                 for k, v in obs:
00609                     changed = getattr(v, '_p_changed', 0)
00610                     count = count + self._recursiveUpdateRoleMappings(v, wfs)
00611                     if changed is None:
00612                         # Re-ghostify.
00613                         v._p_deactivate()
00614         return count

Here is the call graph for this function:

Here is the caller graph for this function:

Reindex the variables that the workflow may have changed.

Also reindexes the security.

Definition at line 625 of file WorkflowTool.py.

00625 
00626     def _reindexWorkflowVariables(self, ob):
00627 
00628         """ Reindex the variables that the workflow may have changed.
00629 
00630         Also reindexes the security.
00631         """
00632         if not self._default_cataloging:
00633             return
00634 
00635         if hasattr(aq_base(ob), 'reindexObject'):
00636             # XXX We only need the keys here, no need to compute values.
00637             mapping = self.getCatalogVariablesFor(ob) or {}
00638             vars = mapping.keys()
00639             ob.reindexObject(idxs=vars)
00640 
00641         # Reindex security of subobjects.
00642         if hasattr(aq_base(ob), 'reindexObjectSecurity'):
00643             ob.reindexObjectSecurity()
00644 
00645 InitializeClass(WorkflowTool)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.WorkflowTool.WorkflowTool._setDefaultCataloging (   self,
  value 
) [private]
Toggle whether '_reindexWorkflowVariables' actually touches
    the catalog (sometimes not desirable, e.g. when the workflow
    objects do this themselves only at particular points).

Definition at line 616 of file WorkflowTool.py.

00616 
00617     def _setDefaultCataloging( self, value ):
00618 
00619         """ Toggle whether '_reindexWorkflowVariables' actually touches
00620             the catalog (sometimes not desirable, e.g. when the workflow
00621             objects do this themselves only at particular points).
00622         """
00623         self._default_cataloging = bool(value)

def CMFCore.WorkflowTool.WorkflowTool.doActionFor (   self,
  ob,
  action,
  wf_id = None,
  args,
  kw 
)
Perform the given workflow action on 'ob'.

Definition at line 222 of file WorkflowTool.py.

00222 
00223     def doActionFor(self, ob, action, wf_id=None, *args, **kw):
00224         """ Perform the given workflow action on 'ob'.
00225         """
00226         wfs = self.getWorkflowsFor(ob)
00227         if wfs is None:
00228             wfs = ()
00229         if wf_id is None:
00230             if not wfs:
00231                 raise WorkflowException(_(u'No workflows found.'))
00232             found = 0
00233             for wf in wfs:
00234                 if wf.isActionSupported(ob, action, **kw):
00235                     found = 1
00236                     break
00237             if not found:
00238                 msg = _(u"No workflow provides the '${action_id}' action.",
00239                         mapping={'action_id': action})
00240                 raise WorkflowException(msg)
00241         else:
00242             wf = self.getWorkflowById(wf_id)
00243             if wf is None:
00244                 raise WorkflowException(
00245                     _(u'Requested workflow definition not found.'))
00246         return self._invokeWithNotification(
00247             wfs, ob, action, wf.doActionFor, (ob, action) + args, kw)

Here is the call graph for this function:

Get a mapping of "workflow-relevant" attributes.

Definition at line 205 of file WorkflowTool.py.

00205 
00206     def getCatalogVariablesFor(self, ob):
00207         """ Get a mapping of "workflow-relevant" attributes.
00208         """
00209         wfs = self.getWorkflowsFor(ob)
00210         if wfs is None:
00211             return None
00212         # Iterate through the workflows backwards so that
00213         # earlier workflows can override later workflows.
00214         wfs.reverse()
00215         vars = {}
00216         for wf in wfs:
00217             v = wf.getCatalogVariablesFor(ob)
00218             if v is not None:
00219                 vars.update(v)
00220         return vars

Here is the call graph for this function:

Here is the caller graph for this function:

Get the chain that applies to the given object.

Definition at line 420 of file WorkflowTool.py.

00420 
00421     def getChainFor(self, ob):
00422         """ Get the chain that applies to the given object.
00423         """
00424         cbt = self._chains_by_type
00425         if isinstance(ob, basestring):
00426             pt = ob
00427         elif hasattr(aq_base(ob), 'getPortalTypeName'):
00428             pt = ob.getPortalTypeName()
00429         else:
00430             pt = None
00431 
00432         if pt is None:
00433             return ()
00434 
00435         chain = None
00436         if cbt is not None:
00437             chain = cbt.get(pt, None)
00438             # Note that if chain is not in cbt or has a value of
00439             # None, we use a default chain.
00440         if chain is None:
00441             return self.getDefaultChain()
00442         return chain

Here is the call graph for this function:

Here is the caller graph for this function:

Get the default chain for this tool.

Definition at line 407 of file WorkflowTool.py.

00407 
00408     def getDefaultChain(self):
00409         """ Get the default chain for this tool.
00410         """
00411         return self._default_chain

Here is the caller graph for this function:

Get the default chain, if applicable, for ob.

Definition at line 483 of file WorkflowTool.py.

00483 
00484     def getDefaultChainFor(self, ob):
00485         """ Get the default chain, if applicable, for ob.
00486         """
00487         # XXX: this method violates the rules for tools/utilities:
00488         # it depends on a non-utility tool
00489         types_tool = getToolByName( self, 'portal_types', None )
00490         if ( types_tool is not None
00491             and types_tool.getTypeInfo( ob ) is not None ):
00492             return self._default_chain
00493 
00494         return ()

Here is the call graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.getHistoryOf (   self,
  wf_id,
  ob 
)
Get the history of an object for a given workflow.

Definition at line 322 of file WorkflowTool.py.

00322 
00323     def getHistoryOf(self, wf_id, ob):
00324         """ Get the history of an object for a given workflow.
00325         """
00326         if hasattr(aq_base(ob), 'workflow_history'):
00327             wfh = ob.workflow_history
00328             return wfh.get(wf_id, None)
00329         return ()

Here is the caller graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.getInfoFor (   self,
  ob,
  name,
  default = _marker,
  wf_id = None,
  args,
  kw 
)
Get the given bit of workflow information for the object.

Definition at line 249 of file WorkflowTool.py.

00249 
00250     def getInfoFor(self, ob, name, default=_marker, wf_id=None, *args, **kw):
00251         """ Get the given bit of workflow information for the object.
00252         """
00253         if wf_id is None:
00254             wfs = self.getWorkflowsFor(ob)
00255             if wfs is None:
00256                 if default is _marker:
00257                     raise WorkflowException(_(u'No workflows found.'))
00258                 else:
00259                     return default
00260             found = 0
00261             for wf in wfs:
00262                 if wf.isInfoSupported(ob, name):
00263                     found = 1
00264                     break
00265             if not found:
00266                 if default is _marker:
00267                     msg = _(u"No workflow provides '${name}' information.",
00268                             mapping={'name': name})
00269                     raise WorkflowException(msg)
00270                 else:
00271                     return default
00272         else:
00273             wf = self.getWorkflowById(wf_id)
00274             if wf is None:
00275                 if default is _marker:
00276                     raise WorkflowException(
00277                         _(u'Requested workflow definition not found.'))
00278                 else:
00279                     return default
00280         res = wf.getInfoFor(ob, name, default, *args, **kw)
00281         if res is _marker:
00282             msg = _(u'Could not get info: ${name}', mapping={'name': name})
00283             raise WorkflowException(msg)
00284         return res

Here is the call graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.getStatusOf (   self,
  wf_id,
  ob 
)
Get the last element of a workflow history for a given workflow.

Definition at line 331 of file WorkflowTool.py.

00331 
00332     def getStatusOf(self, wf_id, ob):
00333         """ Get the last element of a workflow history for a given workflow.
00334         """
00335         wfh = self.getHistoryOf(wf_id, ob)
00336         if wfh:
00337             return wfh[-1]
00338         return None

Here is the call graph for this function:

Retrieve a given workflow.

Definition at line 465 of file WorkflowTool.py.

00465 
00466     def getWorkflowById(self, wf_id):
00467         """ Retrieve a given workflow.
00468         """
00469         wf = getattr(self, wf_id, None)
00470         if IWorkflowDefinition.providedBy(wf):
00471             return wf
00472         if getattr(wf, '_isAWorkflow', False):
00473             # BBB
00474             warn("The '_isAWorkflow' marker attribute for workflow "
00475                  "definitions is deprecated and will be removed in "
00476                  "CMF 2.3;  please mark the definition with "
00477                  "'IWorkflowDefinition' instead.",
00478                  DeprecationWarning, stacklevel=2)
00479             return wf
00480         else:
00481             return None

Here is the call graph for this function:

Here is the caller graph for this function:

Return the list of workflow ids.

Definition at line 496 of file WorkflowTool.py.

00496 
00497     def getWorkflowIds(self):
00498 
00499         """ Return the list of workflow ids.
00500         """
00501         wf_ids = []
00502 
00503         for obj_name, obj in self.objectItems():
00504             if IWorkflowDefinition.providedBy(obj):
00505                 wf_ids.append(obj_name)
00506             elif getattr(obj, '_isAWorkflow', 0):
00507                 # BBB
00508                 warn("The '_isAWorkflow' marker attribute for workflow "
00509                      "definitions is deprecated and will be removed in "
00510                      "CMF 2.3;  please mark the definition with "
00511                      "'IWorkflowDefinition' instead.",
00512                      DeprecationWarning, stacklevel=2)
00513                 wf_ids.append(obj_name)
00514 
00515         return tuple(wf_ids)

Here is the call graph for this function:

Here is the caller graph for this function:

Find the workflows for the type of the given object.

Definition at line 517 of file WorkflowTool.py.

00517 
00518     def getWorkflowsFor(self, ob):
00519 
00520         """ Find the workflows for the type of the given object.
00521         """
00522         res = []
00523         for wf_id in self.getChainFor(ob):
00524             wf = self.getWorkflowById(wf_id)
00525             if wf is not None:
00526                 res.append(wf)
00527         return res

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.listActions (   self,
  info = None,
  object = None 
)
Returns a list of actions to be displayed to the user.

o Invoked by the portal_actions tool.

o Allows workflows to include actions to be displayed in the
  actions box.

o Object actions are supplied by workflows that apply to the object.

o Global actions are supplied by all workflows.

Definition at line 161 of file WorkflowTool.py.

00161 
00162     def listActions(self, info=None, object=None):
00163 
00164         """ Returns a list of actions to be displayed to the user.
00165 
00166         o Invoked by the portal_actions tool.
00167 
00168         o Allows workflows to include actions to be displayed in the
00169           actions box.
00170 
00171         o Object actions are supplied by workflows that apply to the object.
00172 
00173         o Global actions are supplied by all workflows.
00174         """
00175         if object is not None or info is None:
00176             info = self._getOAI(object)
00177         chain = self.getChainFor(info.object)
00178         did = {}
00179         actions = []
00180 
00181         for wf_id in chain:
00182             did[wf_id] = 1
00183             wf = self.getWorkflowById(wf_id)
00184             if wf is not None:
00185                 a = wf.listObjectActions(info)
00186                 if a is not None:
00187                     actions.extend(a)
00188                 a = wf.listGlobalActions(info)
00189                 if a is not None:
00190                     actions.extend(a)
00191 
00192         wf_ids = self.getWorkflowIds()
00193         for wf_id in wf_ids:
00194             if not did.has_key(wf_id):
00195                 wf = self.getWorkflowById(wf_id)
00196                 if wf is not None:
00197                     a = wf.listGlobalActions(info)
00198                     if a is not None:
00199                         actions.extend(a)
00200         return actions

Here is the call graph for this function:

Here is the caller graph for this function:

List portal type specific chain overrides.

Definition at line 413 of file WorkflowTool.py.

00413 
00414     def listChainOverrides(self):
00415         """ List portal type specific chain overrides.
00416         """
00417         cbt = self._chains_by_type
00418         return cbt and sorted(cbt.items()) or ()

def CMFCore.WorkflowTool.WorkflowTool.manage_changeWorkflows (   self,
  default_chain,
  props = None,
  REQUEST = None 
)
Changes which workflows apply to objects of which type.

Definition at line 114 of file WorkflowTool.py.

00114 
00115     def manage_changeWorkflows(self, default_chain, props=None, REQUEST=None):
00116         """ Changes which workflows apply to objects of which type.
00117         """
00118         if props is None:
00119             props = REQUEST
00120         cbt = self._chains_by_type
00121         if cbt is None:
00122             self._chains_by_type = cbt = PersistentMapping()
00123         ti = self._listTypeInfo()
00124         # Set up the chains by type.
00125         if not (props is None):
00126             for t in ti:
00127                 id = t.getId()
00128                 field_name = 'chain_%s' % id
00129                 chain = props.get(field_name, '(Default)').strip()
00130                 if chain == '(Default)':
00131                     # Remove from cbt.
00132                     if cbt.has_key(id):
00133                         del cbt[id]
00134                 else:
00135                     chain = chain.replace(',', ' ')
00136                     ids = []
00137                     for wf_id in chain.split(' '):
00138                         if wf_id:
00139                             if not self.getWorkflowById(wf_id):
00140                                 raise ValueError, (
00141                                     '"%s" is not a workflow ID.' % wf_id)
00142                             ids.append(wf_id)
00143                     cbt[id] = tuple(ids)
00144         # Set up the default chain.
00145         default_chain = default_chain.replace(',', ' ')
00146         ids = []
00147         for wf_id in default_chain.split(' '):
00148             if wf_id:
00149                 if not self.getWorkflowById(wf_id):
00150                     raise ValueError, (
00151                         '"%s" is not a workflow ID.' % wf_id)
00152                 ids.append(wf_id)
00153         self._default_chain = tuple(ids)
00154         if REQUEST is not None:
00155             return self.manage_selectWorkflows(REQUEST,
00156                             manage_tabs_message='Changed.')

Here is the call graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.manage_selectWorkflows (   self,
  REQUEST,
  manage_tabs_message = None 
)
Show a management screen for changing type to workflow connections.

Definition at line 86 of file WorkflowTool.py.

00086 
00087     def manage_selectWorkflows(self, REQUEST, manage_tabs_message=None):
00088 
00089         """ Show a management screen for changing type to workflow connections.
00090         """
00091         cbt = self._chains_by_type
00092         ti = self._listTypeInfo()
00093         types_info = []
00094         for t in ti:
00095             id = t.getId()
00096             title = t.Title()
00097             if title == id:
00098                 title = None
00099             if cbt is not None and cbt.has_key(id):
00100                 chain = ', '.join(cbt[id])
00101             else:
00102                 chain = '(Default)'
00103             types_info.append({'id': id,
00104                                'title': title,
00105                                'chain': chain})
00106         return self._manage_selectWorkflows(
00107             REQUEST,
00108             default_chain=', '.join(self._default_chain),
00109             types_info=types_info,
00110             management_view='Workflows',
00111             manage_tabs_message=manage_tabs_message)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.notifyBefore (   self,
  ob,
  action 
)
Notify all applicable workflows of an action before it happens.

Definition at line 295 of file WorkflowTool.py.

00295 
00296     def notifyBefore(self, ob, action):
00297         """ Notify all applicable workflows of an action before it happens.
00298         """
00299         wfs = self.getWorkflowsFor(ob)
00300         for wf in wfs:
00301             wf.notifyBefore(ob, action)
00302             notify(ActionWillBeInvokedEvent(ob, wf, action))

Here is the call graph for this function:

Notify all applicable workflows that an object has been created.

Definition at line 286 of file WorkflowTool.py.

00286 
00287     def notifyCreated(self, ob):
00288         """ Notify all applicable workflows that an object has been created.
00289         """
00290         wfs = self.getWorkflowsFor(ob)
00291         for wf in wfs:
00292             wf.notifyCreated(ob)
00293         self._reindexWorkflowVariables(ob)

Here is the call graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.notifyException (   self,
  ob,
  action,
  exc 
)
Notify all applicable workflows that an action failed.

Definition at line 313 of file WorkflowTool.py.

00313 
00314     def notifyException(self, ob, action, exc):
00315         """ Notify all applicable workflows that an action failed.
00316         """
00317         wfs = self.getWorkflowsFor(ob)
00318         for wf in wfs:
00319             wf.notifyException(ob, action, exc)
00320             notify(ActionRaisedExceptionEvent(ob, wf, action, exc))

Here is the call graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.notifySuccess (   self,
  ob,
  action,
  result = None 
)
Notify all applicable workflows that an action has taken place.

Definition at line 304 of file WorkflowTool.py.

00304 
00305     def notifySuccess(self, ob, action, result=None):
00306         """ Notify all applicable workflows that an action has taken place.
00307         """
00308         wfs = self.getWorkflowsFor(ob)
00309         for wf in wfs:
00310             wf.notifySuccess(ob, action, result)
00311             notify(ActionSucceededEvent(ob, wf, action, result))

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.setChainForPortalTypes (   self,
  pt_names,
  chain,
  verify = True,
  REQUEST = None 
)
Set a chain for specific portal types.

Definition at line 380 of file WorkflowTool.py.

00380 
00381                                REQUEST=None):
00382         """ Set a chain for specific portal types.
00383         """
00384         cbt = self._chains_by_type
00385         if cbt is None:
00386             self._chains_by_type = cbt = PersistentMapping()
00387 
00388         if chain is None:
00389             for type_id in pt_names:
00390                 if cbt.has_key(type_id):
00391                     del cbt[type_id]
00392             return
00393 
00394         if isinstance(chain, basestring):
00395             if chain == '(Default)':
00396                 chain = ''
00397             else:
00398                 chain = [ wf.strip() for wf in chain.split(',') if wf.strip() ]
00399 
00400         ti_ids = [ t.getId() for t in self._listTypeInfo() ]
00401 
00402         for type_id in pt_names:
00403             if verify and not (type_id in ti_ids):
00404                 continue
00405             cbt[type_id] = tuple(chain)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.setDefaultChain (   self,
  default_chain,
  REQUEST = None 
)
Set the default chain for this tool.

Definition at line 364 of file WorkflowTool.py.

00364 
00365     def setDefaultChain(self, default_chain, REQUEST=None):
00366         """ Set the default chain for this tool.
00367         """
00368         default_chain = default_chain.replace(',', ' ')
00369         ids = []
00370         for wf_id in default_chain.split(' '):
00371             if wf_id:
00372                 if not self.getWorkflowById(wf_id):
00373                     raise ValueError('"%s" is not a workflow ID.' % wf_id)
00374                 ids.append(wf_id)
00375 
00376         self._default_chain = tuple(ids)

Here is the call graph for this function:

def CMFCore.WorkflowTool.WorkflowTool.setStatusOf (   self,
  wf_id,
  ob,
  status 
)
Append a record to the workflow history of a given workflow.

Definition at line 340 of file WorkflowTool.py.

00340 
00341     def setStatusOf(self, wf_id, ob, status):
00342         """ Append a record to the workflow history of a given workflow.
00343         """
00344         wfh = None
00345         has_history = 0
00346         if hasattr(aq_base(ob), 'workflow_history'):
00347             history = ob.workflow_history
00348             if history is not None:
00349                 has_history = 1
00350                 wfh = history.get(wf_id, None)
00351                 if wfh is not None:
00352                     wfh = list(wfh)
00353         if not wfh:
00354             wfh = []
00355         wfh.append(status)
00356         if not has_history:
00357             ob.workflow_history = PersistentMapping()
00358         ob.workflow_history[wf_id] = tuple(wfh)

def CMFCore.WorkflowTool.WorkflowTool.updateRoleMappings (   self,
  REQUEST = None 
)
Allow workflows to update the role-permission mappings.

Definition at line 448 of file WorkflowTool.py.

00448 
00449     def updateRoleMappings(self, REQUEST=None):
00450         """ Allow workflows to update the role-permission mappings.
00451         """
00452         wfs = {}
00453         for id in self.objectIds():
00454             wf = self.getWorkflowById(id)
00455             if hasattr(aq_base(wf), 'updateRoleMappingsFor'):
00456                 wfs[id] = wf
00457         portal = aq_parent(aq_inner(self))
00458         count = self._recursiveUpdateRoleMappings(portal, wfs)
00459         if REQUEST is not None:
00460             return self.manage_selectWorkflows(REQUEST, manage_tabs_message=
00461                                                '%d object(s) updated.' % count)
00462         else:
00463             return count

Here is the call graph for this function:


Member Data Documentation

tuple CMFCore.WorkflowTool.WorkflowTool.__implements__ = (z2IWorkflowTool, ActionProviderBase.__implements__) [static, private]

Definition at line 59 of file WorkflowTool.py.

Definition at line 65 of file WorkflowTool.py.

Definition at line 67 of file WorkflowTool.py.

Definition at line 622 of file WorkflowTool.py.

tuple CMFCore.WorkflowTool.WorkflowTool._default_chain = ('default_workflow',) [static, private]

Definition at line 66 of file WorkflowTool.py.

Definition at line 152 of file WorkflowTool.py.

tuple CMFCore.WorkflowTool.WorkflowTool._manage_selectWorkflows = DTMLFile('selectWorkflows', _dtmldir) [static, private]

Definition at line 83 of file WorkflowTool.py.

tuple CMFCore.WorkflowTool.WorkflowTool._product_interfaces = (IWorkflowDefinition,) [static, private]

Definition at line 63 of file WorkflowTool.py.

string CMFCore.WorkflowTool.WorkflowTool.id = 'portal_workflow' [static]

Definition at line 61 of file WorkflowTool.py.

Initial value:
( { 'label' : 'Workflows'
                       , 'action' : 'manage_selectWorkflows'
                       }
                     , { 'label' : 'Overview', 'action' : 'manage_overview' }
                     )

Definition at line 71 of file WorkflowTool.py.

tuple CMFCore.WorkflowTool.WorkflowTool.manage_overview = DTMLFile( 'explainWorkflowTool', _dtmldir ) [static]

Definition at line 81 of file WorkflowTool.py.

string CMFCore.WorkflowTool.WorkflowTool.meta_type = 'CMF Workflow Tool' [static]

Definition at line 62 of file WorkflowTool.py.

tuple CMFCore.WorkflowTool.WorkflowTool.security = ClassSecurityInfo() [static]

Definition at line 69 of file WorkflowTool.py.


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