[Twisted-Python] Deferring the return within PB

Edmund Dengler edmundd at eSentire.com
Sat Aug 9 18:17:13 MDT 2003


As I forge ahead, another question rears it's ugly head to be thrashed!

I am calling a PB perspective method from the client to the server.

    def perspective_transferXXX(self, XXX):
        ...deal with this item...

I would like to perform a database operation on the server end. How do I
defer the return statement til the operation is done?

Roughly speaking:

    def perspective_transferXXX(self, XXX):
        ...perform the database operation, defer to doneTransferXXX()...
        ...do NOT return a value for the perspective call...

    def doneTransferXXX(self, XXX):
        ...perform any other cleanup...
        ...NOW return a value for the perspective call...


I would note that the use of Deferred's and such looks like it is slowly
going towards the model of continuation-style-passing (a very funky and
mind twisting model from the functional languages world), which would
allow for this sort of asynchronous operation very cleanly.

How would I specify the above effects within Twisted? I have tried to see
if this was answered in the documentation or the archive lists, to no
effect.

Regards!
Ed





More information about the Twisted-Python mailing list