entities/wfobjs.py
changeset 3458 b7621175989a
parent 3451 6b46d73823f5
child 3536 f6c9a5df80fb
equal deleted inserted replaced
3457:0924d0d08d60 3458:b7621175989a
   450         """change the entity's state by firing transition of the given name in
   450         """change the entity's state by firing transition of the given name in
   451         entity's workflow
   451         entity's workflow
   452         """
   452         """
   453         assert self.current_workflow
   453         assert self.current_workflow
   454         tr = self.current_workflow.transition_by_name(trname)
   454         tr = self.current_workflow.transition_by_name(trname)
   455         assert tr is not None, 'not a %s transition: %s' % (self.__regid__, trname)
   455         if tr is None:
       
   456             raise WorkflowException('not a %s transition: %s' % (self.__regid__,
       
   457                                                                  trname))
   456         return self._add_trinfo(comment, commentformat, tr.eid)
   458         return self._add_trinfo(comment, commentformat, tr.eid)
   457 
   459 
   458     def change_state(self, statename, comment=None, commentformat=None, tr=None):
   460     def change_state(self, statename, comment=None, commentformat=None, tr=None):
   459         """change the entity's state to the given state (name or entity) in
   461         """change the entity's state to the given state (name or entity) in
   460         entity's workflow. This method should only by used by manager to fix an
   462         entity's workflow. This method should only by used by manager to fix an