cleanup 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 25 Aug 2009 18:30:44 +0200
branch3.5
changeset 2991 dab951c08896
parent 2990 f221ba8552ab
child 2992 a5b8bf107a1a
cleanup
entities/wfobjs.py
--- a/entities/wfobjs.py	Tue Aug 25 18:30:29 2009 +0200
+++ b/entities/wfobjs.py	Tue Aug 25 18:30:44 2009 +0200
@@ -168,6 +168,11 @@
     def workflow(self):
         return self.transition_of[0]
 
+    def has_input_state(self, state):
+        if hasattr(state, 'eid'):
+            state = state.eid
+        return any(s for s in self.reverse_allowed_transition if s.eid == state)
+
     def may_be_fired(self, eid):
         """return true if the logged user may fire this transition
 
@@ -233,11 +238,6 @@
     def destination(self):
         return self.destination_state[0]
 
-    def has_input_state(self, state):
-        if hasattr(state, 'eid'):
-            state = state.eid
-        return any(s for s in self.reverse_allowed_transition if s.eid == state)
-
 
 class WorkflowTransition(BaseTransition):
     """customized class for WorkflowTransition entities"""
@@ -362,7 +362,7 @@
     @property
     def current_workflow(self):
         """return current workflow applied to this entity"""
-        return self.current_state.workflow
+        return self.current_state and self.current_state.workflow or self.main_workflow
 
     @property
     def current_state(self):