[Twisted-Python] A small patch for defer.py

User Paolino paolo_veronelli at yahoo.it
Sat Apr 16 12:50:02 MDT 2005


def deferredReady(value=False,later=0):
  deferred=Deferred()
  reactor.callLater(later,deferred.callback,value)
  return deferred

def generatorLoop(generator,listOfParams,multi=False):
  lista=[]
  for params in listOfParams:
    if multi:
      lista.append(deferredGenerator(generator)(*params))
    else:
      lista.append(deferredGenerator(generator)(params))  
  return DeferredList(lista)


Thanks Paolino






More information about the Twisted-Python mailing list