def load_workflow(type_key, ti): """Load (from XML definition), set the workflow instance, and setup (once). """ if ti.workflow_key is None: return assert ti.workflow is None workflow_file_key = ti.workflow_key # workflow file name # workflow_name -> what becomes workflow.name (and ti.permissions_type_key) workflow_name = workflow_file_key if ti.custom and type_key != workflow_file_key: workflow_name = type_key # !+ only (non-custom type) "address" wf is multi-used by user_address/group_address try: # retrieve ti.workflow = Workflow.get_singleton(workflow_name) log.warn("Already Loaded WORKFLOW: %s.xml as %r - %s" % (workflow_file_key, workflow_name, ti.workflow)) except KeyError: # load ti.workflow = xmlimport.load(workflow_file_key, workflow_name) log.info("Loaded WORKFLOW: %s.xml as %r - %s" % (workflow_file_key, workflow_name, ti.workflow)) # debug info for state_key, state in ti.workflow.states.items(): log.debug(" STATE: %s %s" % (state_key, state)) for p in state.permissions: log.debug(" %s" % (p, )) # setup if ti.workflow: apply_customization_workflow(type_key, ti) register_specific_workflow_adapter(ti)
def get_loaded_workflow(workflow_name): """Retrieve the previously loaded named workflow. """ try: return Workflow.get_singleton(workflow_name) except KeyError: return None # no such workflow (or workflow not yet loaded)
def load_workflow(type_key, ti): """Load (from XML definition), set the workflow instance, and setup (once). """ if ti.workflow_key is None: return assert ti.workflow is None workflow_file_key = ti.workflow_key # workflow file name # workflow_name -> what becomes workflow.name (and ti.permissions_type_key) workflow_name = workflow_file_key if ti.custom and type_key != workflow_file_key: workflow_name = type_key # !+ only (non-custom type) "address" wf is multi-used by user_address/group_address try: # retrieve ti.workflow = Workflow.get_singleton(workflow_name) log.warn("Already Loaded WORKFLOW: %s.xml as %r - %s" % ( workflow_file_key, workflow_name, ti.workflow)) except KeyError: # load ti.workflow = xmlimport.load(workflow_file_key, workflow_name) log.info("Loaded WORKFLOW: %s.xml as %r - %s" % ( workflow_file_key, workflow_name, ti.workflow)) # debug info for state_key, state in ti.workflow.states.items(): log.debug(" STATE: %s %s" % (state_key, state)) for p in state.permissions: log.debug(" %s" % (p,)) # setup if ti.workflow: apply_customization_workflow(type_key, ti) register_specific_workflow_adapter(ti)
def get_loaded_workflow(workflow_name): """Retrieve the previously loaded workflow.""" try: return Workflow.get_singleton(workflow_name) except KeyError: return None # not a "workflowed" feature
def get_loaded_workflow(workflow_name): """Retrieve the previously loaded workflow.""" try: return Workflow.get_singleton(workflow_name) except KeyError: return None # not a "workflowed" feature