# HG changeset patch # User Sylvain Thénault # Date 1251217844 -7200 # Node ID dab951c088966edfdb8f6c873a952aaaf32e49df # Parent f221ba8552abbc5a375db1741644e8ca7b2e8cf1 cleanup diff -r f221ba8552ab -r dab951c08896 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):