Commit f736b226 authored by Ontje Lünsdorf's avatar Ontje Lünsdorf
Browse files

Return the event itself upon succeed or fail.

parent e5aa09cf
...@@ -182,6 +182,7 @@ class Event(object): ...@@ -182,6 +182,7 @@ class Event(object):
self.ok = True self.ok = True
self._value = value self._value = value
self.env.schedule(self, DEFAULT_PRIORITY) self.env.schedule(self, DEFAULT_PRIORITY)
return self
def fail(self, exception): def fail(self, exception):
"""Schedule the event and mark it as failed. """Schedule the event and mark it as failed.
...@@ -203,6 +204,7 @@ class Event(object): ...@@ -203,6 +204,7 @@ class Event(object):
self.ok = False self.ok = False
self._value = exception self._value = exception
self.env.schedule(self, DEFAULT_PRIORITY) self.env.schedule(self, DEFAULT_PRIORITY)
return self
def __and__(self, other): def __and__(self, other):
return Condition(self.env, all_events, [self, other]) return Condition(self.env, all_events, [self, other])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment