context manager now returns a boolean 'result' as the context variable to indicate whether the transition timed out or if you are actually locked when entering the context body

This commit is contained in:
Thom Nichols
2010-06-07 13:43:37 -04:00
parent 66cf0c2021
commit 47f1fb1690
2 changed files with 11 additions and 8 deletions

View File

@@ -182,12 +182,12 @@ class _StateCtx:
if time.time() >= start + self.wait:
logging.debug('StateMachine timeout while waiting for state: %s', self.from_state )
self._timeout = True # to indicate we should not transition
break
return False
self.state_machine.lock.wait(self.wait)
logging.debug('StateMachine entered context in state: %s',
self.state_machine.current_state() )
return self.state_machine
return True
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_val is not None: