DCWorkflow Package — Products.DCWorkflow 2.4.0.dev0 documentation

# DCWorkflow Package

## `DCWorkflow` Package

Web-configurable workflow.

`Products.DCWorkflow.__init__.` `initialize`(context)

## `ContainerTab` Module

A convenient base class for representing a container as a management tab.

class `Products.DCWorkflow.ContainerTab.` `ContainerTab`(id)

  Bases: `OFS.Folder.Folder`

  Folders are basic container objects that provide a standard interface for object management. Folder objects also implement a management interface and can have arbitrary properties.

  `get`(name, default=None)
  `getId`()
  `has_key`(key)
  `items`()
  `keys`()
  `manage_options`()
  `manage_options__roles__` = ('Manager',)
  `manage_renameObjects`(ids=[], new_ids=[], REQUEST=None)

    Rename several sub-objects

  `manage_renameObjects__roles__` = ('Manager',)
  `manage_workspace`(RESPONSE)

    Redirects to the primary option.

  `manage_workspace__roles__` = ('Manager',)
  `meta_types` = ()
  `objectIds`(spec=None)
  `values`()

## `DCWorkflow` Module

Web-configurable workflow.

class `Products.DCWorkflow.DCWorkflow.` `DCWorkflowDefinition`(id)

  Bases: `Products.DCWorkflow.WorkflowUIMixin.WorkflowUIMixin`, `OFS.Folder.Folder`

  This class is the workflow engine and the container for the workflow definition. UI methods are in WorkflowUIMixin.

  `allowCreate`(container, type_name)

    Returns true if the user is allowed to create a workflow instance.

    The object passed to the guard is the prospective container.

  `allowCreate__roles__` = ()
  `creation_guard` = None
  `description` = ''
  `doActionFor`(ob, action, comment='', **kw)

    Allows the user to request a workflow action. This method must perform its own security checks.

  `doActionFor__roles__` = ()
  `getCatalogVariablesFor`(ob)

    Allows this workflow to make workflow-specific variables available to the catalog, making it possible to implement worklists in a simple way. Returns a mapping containing the catalog variables that apply to ob.

  `getCatalogVariablesFor__roles__` = ()
  `getInfoFor`(ob, name, default)

    Allows the user to request information provided by the workflow. This method must perform its own security checks.

  `getInfoFor__roles__` = ()
  `groups` = ()
  `initial_state` = None
  `isActionSupported`(ob, action, **kw)

    Returns a true value if the given action name is possible in the current state.

  `isActionSupported__roles__` = ()
  `isInfoSupported`(ob, name)

    Returns a true value if the given info name is supported.

  `isInfoSupported__roles__` = ()
  `listGlobalActions`(info)

    Allows this workflow to include actions to be displayed in the actions box. Called on every request. Returns the actions to be displayed to the user.

  `listGlobalActions__roles__` = ()
  `listObjectActions`(info)

    Allows this workflow to include actions to be displayed in the actions box. Called only when this workflow is applicable to info.object. Returns the actions to be displayed to the user.

  `listObjectActions__roles__` = ()
  `manage_options` = ({'action': 'manage_properties', 'label': 'Properties'}, {'action': 'states/manage_main', 'label': 'States'}, {'action': 'transitions/manage_main', 'label': 'Transitions'}, {'action': 'variables/manage_main', 'label': 'Variables'}, {'action': 'worklists/manage_main', 'label': 'Worklists'}, {'action': 'scripts/manage_main', 'label': 'Scripts'}, {'action': 'manage_permissions', 'label': 'Permissions'}, {'action': 'manage_groups', 'label': 'Groups'})
  `manager_bypass` = 0
  `meta_types` = ()
  `notifyBefore`(ob, action)

    Notifies this workflow of an action before it happens, allowing veto by exception. Unless an exception is thrown, either a notifySuccess() or notifyException() can be expected later on. The action usually corresponds to a method name.

  `notifyBefore__roles__` = ()
  `notifyCreated`(ob)

    Notifies this workflow after an object has been created and added.

  `notifyCreated__roles__` = ()
  `notifyException`(ob, action, exc)

    Notifies this workflow that an action failed.

  `notifyException__roles__` = ()
  `notifySuccess`(ob, action, result)

    Notifies this workflow that an action has taken place.

  `notifySuccess__roles__` = ()
  `permissions` = ()
  `roles` = None
  `scripts` = None
  `state_var` = 'state'
  `states` = None
  `title` = 'DC Workflow Definition'
  `transitions` = None
  `updateRoleMappingsFor`(ob)

    Changes the object permissions according to the current state.

  `updateRoleMappingsFor__roles__` = ()
  `variables` = None
  `worklists` = None

`Products.DCWorkflow.DCWorkflow.` `bad_id`()

  search(string[, pos[, endpos]]) –> match object or None. Scan through string looking for a match, and return a corresponding match object instance. Return None if no position in the string matches.

`Products.DCWorkflow.DCWorkflow.` `checkId`(id)

## `Expression` Module

Expressions in a web-configurable workflow.

class `Products.DCWorkflow.Expression.` `SafeMapping`

  Bases: `MultiMapping`

  Mapping with security declarations and limited method exposure.

  Since it subclasses MultiMapping, this class can be used to wrap one or more mapping objects. Restricted Python code will not be able to mutate the SafeMapping or the wrapped mappings, but will be able to read any value.

  `pop` = None
  `push` = None

class `Products.DCWorkflow.Expression.` `StateChangeInfo`(object, workflow, status=None, transition=None, old_state=None, new_state=None, kwargs=None)

  Bases: `object`

  Provides information for expressions and scripts.

  exception `ObjectDeleted`(result=None)

    Bases: `exceptions.Exception`

    Raise to tell the workflow tool that the object has been deleted.

    Swallowed by the workflow tool.

    `getResult`()
  exception `ObjectMoved`(new_ob, result=None)

    Bases: `exceptions.Exception`

    Raise to tell the workflow tool that the object has moved.

    Swallowed by the workflow tool.

    `getNewObject`()
    `getResult`()
  `getDateTime`()
  `getHistory`()
  `getPortal`()

`Products.DCWorkflow.Expression.` `createExprContext`(sci)

  An expression context provides names for TALES expressions.

## `Guard` Module

Guard conditions in a web-configurable workflow.

class `Products.DCWorkflow.Guard.` `Guard`

  Bases: `Persistence.Persistent`, `ExplicitAcquirer`

  Persistent ExtensionClass

  `changeFromProperties`(props)

    Returns 1 if changes were specified.

  `check`(sm, wf_def, ob, **kw)

    Checks conditions in this guard.

  `expr` = None
  `getExprText`()
  `getExprText__roles__`

    PermissionRole C implementation

  `getGroupsText`()
  `getGroupsText__roles__`

    PermissionRole C implementation

  `getPermissionsText`()
  `getPermissionsText__roles__`

    PermissionRole C implementation

  `getRolesText`()
  `getRolesText__roles__`

    PermissionRole C implementation

  `getSummary`()
  `getSummary__roles__`

    PermissionRole C implementation

  `groups` = ()
  `guardForm` = <App.special_dtml.DTMLFile object>
  `permissions` = ()
  `roles` = ()

`Products.DCWorkflow.Guard.` `formatNameUnion`(names)

## `Scripts` Module

Scripts in a web-configurable workflow.

class `Products.DCWorkflow.Scripts.` `Scripts`(id)

  Bases: `Products.DCWorkflow.ContainerTab.ContainerTab`

  A container for workflow scripts

  `manage_main`(client=None, REQUEST=None, **kw)
  `manage_main__roles__` = ('Manager',)
  `meta_type` = 'Workflow Scripts'
  `meta_types` = ()

## `States` Module

States in a web-configurable workflow.

class `Products.DCWorkflow.States.` `StateDefinition`(id)

  Bases: `OFS.SimpleItem.SimpleItem`

  State definition

  `addVariable`(id, value, REQUEST=None)

    Add a WorkflowVariable to State.

  `deleteVariables`(ids=[], REQUEST=None)

    Delete a WorkflowVariable from State.

  `description` = ''
  `getAvailableRoles`()
  `getAvailableTransitionIds`()
  `getAvailableVarIds`()
  `getGroupInfo`(group)

    Returns the list of roles to be assigned to a group.

  `getId`()
  `getManagedPermissions`()
  `getPermissionInfo`(p)

    Returns the list of roles to be assigned to a permission.

  `getTransitionTitle`(tid)
  `getTransitions`()
  `getVariableValues`()

    Get VariableValues for management UI.

  `getWorkflow`()
  `getWorkflowVariables`()

    Get all variables that are available from the workflow and not handled yet.

  `group_roles` = None
  `manage_groups` = <PageTemplateFile at state_groups>
  `manage_groups__roles__` = ('Manager',)
  `manage_options` = ({'action': 'manage_properties', 'label': 'Properties'}, {'action': 'manage_permissions', 'label': 'Permissions'}, {'action': 'manage_groups', 'label': 'Groups'}, {'action': 'manage_variables', 'label': 'Variables'})
  `manage_permissions`(REQUEST, manage_tabs_message=None)

    Present TTW UI for managing this State’s permissions.

  `manage_permissions__roles__` = ('Manager',)
  `manage_properties`(REQUEST, manage_tabs_message=None)

    Show state properties ZMI form.

  `manage_properties__roles__` = ('Manager',)
  `manage_variables`(REQUEST, manage_tabs_message=None)

    Show State variables ZMI form.

  `manage_variables__roles__` = ('Manager',)
  `meta_type` = 'Workflow State'
  `permission_roles` = None
  `setGroups`(REQUEST, RESPONSE=[])

    Set the group to role mappings in REQUEST for this State.

  `setPermission`(permission, acquired, roles, REQUEST=[])

    Set a permission for this State.

  `setPermissions`(REQUEST)

    Set the permissions in REQUEST for this State.

  `setProperties`(title='', transitions=(), REQUEST=None, description='')

    Set the properties for this State.

  `setVariables`(ids=[], REQUEST=None)

    Set values for Variables set by this State.

  `title` = ''
  `transitions` = ()
  `var_values` = None

class `Products.DCWorkflow.States.` `States`(id)

  Bases: `Products.DCWorkflow.ContainerTab.ContainerTab`

  A container for state definitions

  `addState`(id, REQUEST=None)
  `all_meta_types` = ({'action': 'addState', 'name': 'Workflow State', 'permission': 'Manage portal'},)
  `deleteStates`(ids, REQUEST=None)
  `manage_main`(REQUEST, manage_tabs_message=None)
  `manage_main__roles__` = ('Manager',)
  `meta_type` = 'Workflow States'
  `meta_types` = ()
  `setInitialState`(id=None, ids=None, REQUEST=None)

## `Transitions` Module

Transitions in a web-configurable workflow.

class `Products.DCWorkflow.Transitions.` `TransitionDefinition`(id)

  Bases: `OFS.SimpleItem.SimpleItem`

  Transition definition

  `actbox_category` = 'workflow'
  `actbox_icon` = ''
  `actbox_name` = ''
  `actbox_url` = ''
  `addVariable`(id, text, REQUEST=None)

    Add a variable expression.

  `after_script_name` = None
  `deleteVariables`(ids=[], REQUEST=None)

    delete a WorkflowVariable from State

  `description` = ''
  `getAvailableScriptIds`()
  `getAvailableStateIds`()
  `getAvailableVarIds`()
  `getGuard`()
  `getGuardSummary`()
  `getId`()
  `getVarExprText`(id)
  `getVariableExprs`()

    get variable exprs for management UI

  `getWorkflow`()
  `getWorkflowVariables`()

    get all variables that are available form workflow and not handled yet.

  `guard` = None
  `manage_options` = ({'action': 'manage_properties', 'label': 'Properties'}, {'action': 'manage_variables', 'label': 'Variables'})
  `manage_properties`(REQUEST, manage_tabs_message=None)
  `manage_properties__roles__` = ('Manager',)
  `manage_variables`(REQUEST, manage_tabs_message=None)
  `manage_variables__roles__` = ('Manager',)
  `meta_type` = 'Workflow Transition'
  `new_state_id` = ''
  `script_name` = None
  `setProperties`(title, new_state_id, trigger_type=1, script_name='', after_script_name='', actbox_name='', actbox_url='', actbox_category='workflow', actbox_icon='', props=None, REQUEST=None, description='')
  `setVariables`(ids=[], REQUEST=None)

    set values for Variables set by this state

  `title` = ''
  `trigger_type` = 1
  `var_exprs` = None

class `Products.DCWorkflow.Transitions.` `Transitions`(id)

  Bases: `Products.DCWorkflow.ContainerTab.ContainerTab`

  A container for transition definitions

  `addTransition`(id, REQUEST=None)
  `all_meta_types` = ({'action': 'addTransition', 'name': 'Workflow Transition', 'permission': 'Manage portal'},)
  `deleteTransitions`(ids, REQUEST=None)
  `manage_main`(REQUEST, manage_tabs_message=None)
  `manage_main__roles__` = ('Manager',)
  `meta_type` = 'Workflow Transitions'
  `meta_types` = ()

## `Variables` Module

Variables in a web-configurable workflow.

class `Products.DCWorkflow.Variables.` `VariableDefinition`(id)

  Bases: `OFS.SimpleItem.SimpleItem`

  Variable definition

  `default_expr` = None
  `default_value` = ''
  `description` = ''
  `for_catalog` = 1
  `for_status` = 1
  `getDefaultExprText`()
  `getInfoGuard`()
  `getInfoGuardSummary`()
  `info_guard` = None
  `manage_options` = ({'action': 'manage_properties', 'label': 'Properties'},)
  `manage_properties`(REQUEST, manage_tabs_message=None)
  `manage_properties__roles__` = ('Manager',)
  `meta_type` = 'Workflow Variable'
  `setProperties`(description, default_value='', default_expr='', for_catalog=0, for_status=0, update_always=0, props=None, REQUEST=None)
  `update_always` = 1

class `Products.DCWorkflow.Variables.` `Variables`(id)

  Bases: `Products.DCWorkflow.ContainerTab.ContainerTab`

  A container for variable definitions

  `addVariable`(id, REQUEST=None)
  `all_meta_types` = ({'action': 'addVariable', 'name': 'Workflow Variable', 'permission': 'Manage portal'},)
  `deleteVariables`(ids, REQUEST=None)
  `getStateVar`()
  `manage_main`(REQUEST, manage_tabs_message=None)
  `manage_main__roles__` = ('Manager',)
  `meta_type` = 'Workflow Variables'
  `meta_types` = ()
  `setStateVar`(id, REQUEST=None)

## `WorkflowUIMixin` Module

Web-configurable workflow UI.

class `Products.DCWorkflow.WorkflowUIMixin.` `WorkflowUIMixin`

  Bases: `object`

  `addGroup`(group, RESPONSE=[], REQUEST=[])

    Adds a group by name.

  `addGroup__roles__`

    PermissionRole C implementation

  `addManagedPermission`(p, REQUEST=[])

    Adds to the list of permissions to manage.

  `addManagedPermission__roles__`

    PermissionRole C implementation

  `delGroups`(groups, RESPONSE=[], REQUEST=[])

    Removes groups by name.

  `delGroups__roles__`

    PermissionRole C implementation

  `delManagedPermissions`(ps, REQUEST=[])

    Removes from the list of permissions to manage.

  `delManagedPermissions__roles__`

    PermissionRole C implementation

  `getAvailableGroups`()

    Returns a list of available group names.

  `getAvailableGroups__roles__`

    PermissionRole C implementation

  `getAvailableRoles`()

    Returns the acquired roles mixed with base_cms roles.

  `getAvailableRoles__roles__`

    PermissionRole C implementation

  `getGroups`()

    Returns the names of groups managed by this workflow.

  `getGroups__roles__`

    PermissionRole C implementation

  `getGuard`()

    Returns the initiation guard.

    If no init guard has been created, returns a temporary object.

  `getGuard__roles__`

    PermissionRole C implementation

  `getPossiblePermissions`()

    Returns the list of all permissions that can be managed.

  `getPossiblePermissions__roles__`

    PermissionRole C implementation

  `getRoles`()

    Returns the list of roles managed by this workflow.

  `getRoles__roles__`

    PermissionRole C implementation

  `guardExprDocs`()

    Returns documentation on guard expressions.

  `guardExprDocs__roles__` = None
  `manage_groups` = <PageTemplateFile at workflow_groups>
  `manage_groups__roles__` = ('Manager',)
  `manage_permissions`(REQUEST, manage_tabs_message=None)

    Displays the form for choosing which permissions to manage.

  `manage_permissions__roles__`

    PermissionRole C implementation

  `manage_properties` = <App.special_dtml.DTMLFile object>
  `manage_properties__roles__`

    PermissionRole C implementation

  `setProperties`(title, manager_bypass=[], props=[], REQUEST=[], description=[])

    Sets basic properties.

  `setProperties__roles__`

    PermissionRole C implementation

  `setRoles`(roles, RESPONSE=[], REQUEST=[])

    Changes the list of roles mapped to groups by this workflow.

  `setRoles__roles__`

    PermissionRole C implementation

## `Worklists` Module

Worklists in a web-configurable workflow.

class `Products.DCWorkflow.Worklists.` `WorklistDefinition`(id)

  Bases: `OFS.SimpleItem.SimpleItem`

  Worklist definiton

  `actbox_category` = 'global'
  `actbox_icon` = ''
  `actbox_name` = ''
  `actbox_url` = ''
  `description` = ''
  `getAvailableCatalogVars`()
  `getGuard`()
  `getGuardSummary`()
  `getVarMatch`(id)
  `getVarMatchKeys`()
  `getVarMatchText`(id)
  `getWorkflow`()
  `guard` = None
  `manage_options` = ({'action': 'manage_properties', 'label': 'Properties'},)
  `manage_properties`(REQUEST, manage_tabs_message=None)
  `manage_properties__roles__` = ('Manager',)
  `meta_type` = 'Worklist'
  `search`(info=None, **kw)

    Perform the search corresponding to this worklist

    Returns sequence of ZCatalog brains - info is a mapping for resolving formatted string variable references - additional keyword/value pairs may be used to restrict the query

  `setProperties`(description, actbox_name='', actbox_url='', actbox_category='global', actbox_icon='', props=None, REQUEST=None)
  `var_matches` = None

class `Products.DCWorkflow.Worklists.` `Worklists`(id)

  Bases: `Products.DCWorkflow.ContainerTab.ContainerTab`

  A container for worklist definitions

  `addWorklist`(id, REQUEST=None)
  `all_meta_types` = ({'action': 'addWorklist', 'name': 'Worklist', 'permission': 'Manage portal'},)
  `deleteWorklists`(ids, REQUEST=None)
  `manage_main`(REQUEST, manage_tabs_message=None)
  `manage_main__roles__` = ('Manager',)
  `meta_type` = 'Worklists'
  `meta_types` = ()

## `events` Module

class `Products.DCWorkflow.events.` `AfterTransitionEvent`(obj, workflow, old_state, new_state, transition, status, kwargs)

  Bases: `Products.DCWorkflow.events.TransitionEvent`

class `Products.DCWorkflow.events.` `BeforeTransitionEvent`(obj, workflow, old_state, new_state, transition, status, kwargs)

  Bases: `Products.DCWorkflow.events.TransitionEvent`

class `Products.DCWorkflow.events.` `TransitionEvent`(obj, workflow, old_state, new_state, transition, status, kwargs)

  Bases: `zope.interface.interfaces.ObjectEvent`

## `exportimport` Module

DCWorkflow export / import support.

class `Products.DCWorkflow.exportimport.` `DCWorkflowDefinitionBodyAdapter`(context, environ)

  Bases: `Products.GenericSetup.utils.BodyAdapterBase`

  Body im- and exporter for DCWorkflowDefinition.

  `body`

    Export the object as a file body.

  `mime_type` = 'text/xml'
  `suffix` = '/definition.xml'

class `Products.DCWorkflow.exportimport.` `WorkflowDefinitionConfigurator`(obj)

  Bases: `Acquirer`

  Synthesize XML description of site’s workflows.

  `generateWorkflowXML`()

    Pseudo API.

  `generateWorkflowXML__roles__`

    PermissionRole C implementation

  `getWorkflowInfo`(workflow_id)

    Return a mapping describing a given workflow.

    o Keys in the mappings:

    > ‘id’ – the ID of the workflow within the tool

    > ‘meta_type’ – the workflow’s meta_type

    > ‘title’ – the workflow’s title property

    > ‘description’ – the workflow’s description property

    o See ‘_extractDCWorkflowInfo’ below for keys present only for
      DCWorkflow definitions.
  `getWorkflowInfo__roles__`

    PermissionRole C implementation

  `getWorkflowScripts`()

    Get workflow scripts information

  `getWorkflowScripts__roles__`

    PermissionRole C implementation

  `parseWorkflowXML`(xml, encoding='utf-8')

    Pseudo API.

  `parseWorkflowXML__roles__`

    PermissionRole C implementation

## `interfaces` Module

DCWorkflow interfaces.

interface `Products.DCWorkflow.interfaces.` `IAfterTransitionEvent`

  Extends: `Products.DCWorkflow.interfaces.ITransitionEvent`

  An event that’s fired after a workflow transition.

interface `Products.DCWorkflow.interfaces.` `IBeforeTransitionEvent`

  Extends: `Products.DCWorkflow.interfaces.ITransitionEvent`

  An event fired before a workflow transition.

interface `Products.DCWorkflow.interfaces.` `IDCWorkflowDefinition`

  Web-configurable workflow definition.

interface `Products.DCWorkflow.interfaces.` `ITransitionEvent`

  Extends: `zope.interface.interfaces.IObjectEvent`

  An event that’s fired upon a workflow transition.

  `status`

    The status dict of the object.

  `new_state`

    The state definition of the workflow state before after transition

  `workflow`

    The workflow definition triggering the transition

  `transition`

    The transition definition taking place. May be None if this is the ‘transition’ to the initial state.

  `kwargs`

    Any keyword arguments passed to doActionFor() when the transition was invoked

  `old_state`

    The state definition of the workflow state before the transition

## `permissions` Module

DCWorkflow product permissions

## `testing` Module

Unit test layers.

class `Products.DCWorkflow.testing.` `ExportImportZCMLLayer`

  Bases: `Testing.ZopeTestCase.layer.ZopeLite`

  classmethod `setUp`()
  classmethod `tearDown`()

## `utils` Module

Some common utilities.

`Products.DCWorkflow.utils.` `ac_inherited_permissions`(ob, all=0)

`Products.DCWorkflow.utils.` `modifyRolesForGroup`(ob, group, grant_roles, managed_roles)

  Modifies local roles for one group.

`Products.DCWorkflow.utils.` `modifyRolesForPermission`(ob, pname, roles)

  Modifies multiple role to permission mappings. roles is a list to acquire, a tuple to not acquire.

## Subpackages

- browser Package
  - `browser` Package
  - `workflow` Module