Changeset 50900

Show
Ignore:
Timestamp:
01/26/07 17:41:06 (3 years ago)
Author:
gracinet
Message:

getCommentBehaviour returns None if transition wasn't find.
(there are workflows without the 'modify' transition)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • CPS3/products/CPSWorkflow/trunk/tests/test_workflow.py

    r50898 r50900  
    213213        self.assertEquals(wft.getCommentBehaviour('t1', dummy, context), 
    214214                          'Comment Behaviour') 
     215        self.assertEquals(wft.getCommentBehaviour('no such transition', 
     216                                                  dummy, context), 
     217                          None) 
    215218 
    216219def test_suite(): 
  • CPS3/products/CPSWorkflow/trunk/workflowtool.py

    r50898 r50900  
    885885 
    886886    def getCommentBehaviour(self, transition_id, proxy, context): 
    887         for wf_id in self.getChainFor(proxy): 
     887        wf_ids = self.getChainFor(proxy) 
     888        for wf_id in wf_ids: 
    888889            wf = self.getWorkflowById(wf_id) 
    889890            tdef = wf.transitions.get(transition_id, None) 
     
    891892                break 
    892893        else: 
    893             raise ValueError("Unknown transition: %s" % transition_id) 
     894            logger.info("getCommentBehaviour; no transition by id %s " 
     895                        "in workflows %s", transition_id, wf_ids) 
     896 
     897            return None # no point having commment if there's no transition 
    894898 
    895899        return tdef.getCommentBehaviour(proxy, context)