Newer
Older
"unpaid": UnpaidRedeemer.make,
"error": ErrorRedeemer.make,
"ristretto": RistrettoRedeemer.make,
}
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
@inlineCallbacks
def bracket(first, last, between):
"""
Invoke an action between two other actions.
:param first: A no-argument function that may return a Deferred. It is
called first.
:param last: A no-argument function that may return a Deferred. It is
called last.
:param between: A no-argument function that may return a Deferred. It is
called after ``first`` is done and completes before ``last`` is called.
:return Deferred: A ``Deferred`` which fires with the result of
``between``.
"""
yield first()
try:
result = yield between()
except GeneratorExit:
raise
except:
yield last()
else:
yield last()
returnValue(result)