def _initDCWorkflowTransitions(workflow, transitions): """ Initialize DCWorkflow transitions """ from Globals import PersistentMapping from Products.DCWorkflow.Transitions import TransitionDefinition for t_info in transitions: id = str(t_info["transition_id"]) # no unicode! if not workflow.transitions.has_key(id): t = TransitionDefinition(id) workflow.transitions._setObject(id, t) t = workflow.transitions._getOb(id) trigger_type = list(TRIGGER_TYPES).index(t_info["trigger"]) action = t_info["action"] guard = t_info["guard"] props = { "guard_roles": ";".join(guard["roles"]), "guard_permissions": ";".join(guard["permissions"]), "guard_groups": ";".join(guard["groups"]), "guard_expr": guard["expression"], } t.setProperties( title=t_info["title"], description=t_info["description"], new_state_id=t_info["new_state"], trigger_type=trigger_type, script_name=t_info["before_script"], after_script_name=t_info["after_script"], actbox_name=action["name"], actbox_url=action["url"], actbox_category=action["category"], props=props, ) t.var_exprs = PersistentMapping(t_info["variables"].items())
def _initDCWorkflowTransitions( workflow, transitions ): """ Initialize DCWorkflow transitions """ from Globals import PersistentMapping from Products.DCWorkflow.Transitions import TransitionDefinition for t_info in transitions: id = str( t_info[ 'transition_id' ] ) # no unicode! if not workflow.transitions.has_key(id): t = TransitionDefinition(id) workflow.transitions._setObject(id, t) t = workflow.transitions._getOb( id ) trigger_type = list( TRIGGER_TYPES ).index( t_info[ 'trigger' ] ) action = t_info[ 'action' ] guard = t_info[ 'guard' ] props = { 'guard_roles' : ';'.join( guard[ 'roles' ] ) , 'guard_permissions' : ';'.join( guard[ 'permissions' ] ) , 'guard_groups' : ';'.join( guard[ 'groups' ] ) , 'guard_expr' : guard[ 'expression' ] } t.setProperties( title = t_info[ 'title' ] , description = t_info[ 'description' ] , new_state_id = t_info[ 'new_state' ] , trigger_type = trigger_type , script_name = t_info[ 'before_script' ] , after_script_name = t_info[ 'after_script' ] , actbox_name = action[ 'name' ] , actbox_url = action[ 'url' ] , actbox_category = action[ 'category' ] , props = props ) var_mapping = [(name, Expression(text)) for name, text in t_info[ 'variables' ].items()] t.var_exprs = PersistentMapping(var_mapping)
def _initDCWorkflowTransitions( workflow, transitions ): """ Initialize DCWorkflow transitions """ from Products.DCWorkflow.Transitions import TransitionDefinition for t_info in transitions: id = str( t_info[ 'transition_id' ] ) # no unicode! if not workflow.transitions.has_key(id): t = TransitionDefinition(id) workflow.transitions._setObject(id, t) t = workflow.transitions._getOb( id ) trigger_type = list( TRIGGER_TYPES ).index( t_info[ 'trigger' ] ) action = t_info[ 'action' ] guard = t_info[ 'guard' ] props = { 'guard_roles' : ';'.join( guard[ 'roles' ] ) , 'guard_permissions' : ';'.join( guard[ 'permissions' ] ) , 'guard_groups' : ';'.join( guard[ 'groups' ] ) , 'guard_expr' : guard[ 'expression' ] } t.setProperties( title = t_info[ 'title' ] , description = t_info[ 'description' ] , new_state_id = t_info[ 'new_state' ] , trigger_type = trigger_type , script_name = t_info[ 'before_script' ] , after_script_name = t_info[ 'after_script' ] , actbox_name = action[ 'name' ] , actbox_url = action[ 'url' ] , actbox_category = action[ 'category' ] , actbox_icon = action.get('icon', '') , props = props ) var_mapping = [(name, Expression(text)) for name, text in t_info[ 'variables' ].items()] t.var_exprs = PersistentMapping(var_mapping)