Remove non-functional retval from utils.delay, making it a straight wrapper for twisted.reactor.callLater.
This commit is contained in:
parent
5b60eef635
commit
086beb1c26
1 changed files with 7 additions and 10 deletions
|
|
@ -880,16 +880,17 @@ def uses_database(name="sqlite3"):
|
||||||
return engine == "django.db.backends.%s" % name
|
return engine == "django.db.backends.%s" % name
|
||||||
|
|
||||||
|
|
||||||
def delay(delay=2, callback=None, retval=None):
|
def delay(delay, callback, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Delay the return of a value.
|
Delay the return of a value.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
delay (int or float): The delay in seconds
|
delay (int or float): The delay in seconds
|
||||||
callback (callable, optional): Will be called without arguments
|
callback (callable): Will be called with optional
|
||||||
or with `retval` after delay seconds.
|
arguments after `delay` seconds.
|
||||||
retval (any, optional): Whis will be returned by this function
|
args (any, optional): Will be used as arguments to callback
|
||||||
after a delay, or as input to callback.
|
Kwargs:
|
||||||
|
any (any): Will be used to call the callback.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
deferred (deferred): Will fire fire with callback after
|
deferred (deferred): Will fire fire with callback after
|
||||||
|
|
@ -899,11 +900,7 @@ def delay(delay=2, callback=None, retval=None):
|
||||||
specified here.
|
specified here.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
callb = callback or defer.Deferred().callback
|
return reactor.callLater(delay, callback, *args, **kwargs)
|
||||||
if retval is not None:
|
|
||||||
return reactor.callLater(delay, callb, retval)
|
|
||||||
else:
|
|
||||||
return reactor.callLater(delay, callb)
|
|
||||||
|
|
||||||
|
|
||||||
_TYPECLASSMODELS = None
|
_TYPECLASSMODELS = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue