[Twisted-web] Question about using Stackless with Twisted.

inhahe inhahe at gmail.com
Wed Jul 23 22:58:21 EDT 2008

I don't know very much about Twisted, but I would like to know how
easy would it be to use twisted with WSGI and use it with Stackless so
that I could use Twisted's defereds but wrap them in a way so that
upon callback my tasklets resume where they had called the defereds
using stackless channels.

to make it more clear, it would be something like:

def dcall(function, paramaters):
  dcall2(function, parameters, stackless.channel())

def dcall2(function, parameters, ch):
  def callback(result): ch.send(result)
  twisted.add_callback(function, parameters, callback)
  return ch.receive()

# in my html rendering..
# do stuff
favorite_color = dcall(async_cursor_execute('select * from
favorite_colors where userid=?', userid)["favoritecolor"]
# do more stuff

know what I mean?

thanks in advance.

More information about the Twisted-web mailing list