[wf] ensure fromstates given, allow to give an entity (avoid spotless error, we can iter on entities...) 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 25 Aug 2009 18:26:05 +0200
branch3.5
changeset 2987 5082dec70ed8
parent 2986 d8f2e53702be
child 2988 89d97d7c0508
[wf] ensure fromstates given, allow to give an entity (avoid spotless error, we can iter on entities...)
entities/wfobjs.py
--- a/entities/wfobjs.py	Tue Aug 25 18:24:54 2009 +0200
+++ b/entities/wfobjs.py	Tue Aug 25 18:26:05 2009 +0200
@@ -111,6 +111,9 @@
         self.req.execute('SET T transition_of WF '
                          'WHERE T eid %(t)s, WF eid %(wf)s',
                          {'t': tr.eid, 'wf': self.eid}, ('t', 'wf'))
+        assert fromstates, fromstates
+        if not isinstance(fromstates, (tuple, list)):
+            fromstates = (fromstates,)
         for state in fromstates:
             if hasattr(state, 'eid'):
                 state = state.eid