don't use assert here
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 23 Sep 2009 23:28:59 +0200
changeset 3458 b7621175989a
parent 3457 0924d0d08d60
child 3461 8a11aeea4d25
don't use assert here
entities/wfobjs.py
--- a/entities/wfobjs.py	Wed Sep 23 20:13:31 2009 +0200
+++ b/entities/wfobjs.py	Wed Sep 23 23:28:59 2009 +0200
@@ -452,7 +452,9 @@
         """
         assert self.current_workflow
         tr = self.current_workflow.transition_by_name(trname)
-        assert tr is not None, 'not a %s transition: %s' % (self.__regid__, trname)
+        if tr is None:
+            raise WorkflowException('not a %s transition: %s' % (self.__regid__,
+                                                                 trname))
         return self._add_trinfo(comment, commentformat, tr.eid)
 
     def change_state(self, statename, comment=None, commentformat=None, tr=None):