[Twisted-Python] some callback function params problems

hoooooosety hoooooosety at gmail.com
Tue Jun 9 03:31:52 MDT 2009


Hello, I have some callback function params problems.

Here is a simple example.

def deferDoSomeInsert(paramA, paramB):
	insertSQL = "..."
	db.runQuery(insertSQL)

def deferDoSomeDelete(paramA, paramB):
	deleteSQL = "..."
	db.runQuery(deleteSQL)

#these two functions are individual and basic, and then, I need compound function which first insert then delete.
#so

def deferCompoundFunc(paramA, paramB):
	return deferDoSomeInsert.addCallback(deferDoSomeDelete, paramA, paramB)

here the problem comes, the first defer will return none as default so there're 3 pramas pass to the second function.

Is there a common way to solve the problem like this. I mean I can still keep the separate functions as the look like now,
and I can compound the basic function to do more complex action using addCallback to link them.

2009-06-09 
hoooooosety 





More information about the Twisted-Python mailing list