[Twisted-web] mixing livepage with threads

Kevin Dangoor kid at kendermedia.com
Sat Mar 5 13:38:04 MST 2005


I'm using a relatively recent vintage Twisted and Nevow (say within the 
past 3 weeks). I'm trying to do something like this:

def myLPHandler(self, client):
    def progress(message):
       # there are a couple of miscellaneous things that happen here... 
trivial, non-blocking, non-io stuff.
       client.set("someid", message)

    def wrappedprogress(message):
       reactor.callFromThread(progress, message)

    reactor.callInThread(someLongRunningThing, wrappedprogress)

Here's what happens:
1) user clicks a button that calls the method above
2) someLongRunningThing starts up
3) it sends progress messages to wrappedprogress
4) a couple messages show up, but after that they just get buffered (I 
can see this with liveevil.DEBUG=True)

Should this work? Is there something else I should be doing to keep 
sending messages across the livepage link?

Generally speaking, LivePage has been great fun to use. It's so easy and 
yet so powerful!

Kevin



More information about the Twisted-web mailing list