[Twisted-Python] DelayedCall enhancements

Here's a patch that adds two particularly useful methods to the IDelayedCall interface and implementation. It's quite possible to do it currently, but it's a kludge. Essentially what I added were methods to delay a DelayedCall by a configurable amount of time, and to reset a DelayedCall to happen a configurable amount of time from now. I also added a test case for each, and they pass. I can check it in if someone gives me the OK. -bob Index: twisted/internet/interfaces.py =================================================================== RCS file: /cvs/Twisted/twisted/internet/interfaces.py,v retrieving revision 1.57 diff -r1.57 interfaces.py 317a318,319
It also may be rescheduled by calling its C{delay()} or C{reset()} methods.
347a350,370
time to delay
@raises twisted.internet.error.AlreadyCalled: if the call has
already
happened. @raises twisted.internet.error.AlreadyCancelled: if the call
has already
fire, equivalent
to C{self.cancel()} and then doing
another
C{reactor.callLater(secondsLater, ...)}
@raises twisted.internet.error.AlreadyCalled: if the call has
already
happened. @raises twisted.internet.error.AlreadyCancelled: if the call
has already
been cancelled. """
Index: twisted/internet/base.py =================================================================== RCS file: /cvs/Twisted/twisted/internet/base.py,v retrieving revision 1.29 diff -r1.29 base.py 48c48 < def __init__(self, time, func, args, kw, cancel): ---
def __init__(self, time, func, args, kw, cancel, reset):
49a50
self.resetter = reset
61a63,79
266c284,290 < tple = DelayedCall(time() + seconds, f, args, kw, self._pendingTimedCalls.remove) ---
tple = DelayedCall(time() + seconds, f, args, kw,
self._pendingTimedCalls.remove, self._resetCallLater)
Index: twisted/test/test_internet.py =================================================================== RCS file: /cvs/Twisted/twisted/test/test_internet.py,v retrieving revision 1.13 diff -r1.13 test_internet.py 102a103,128
participants (1)
-
Bob Ippolito