[Twisted-Python] Interview question on deferreds

2009-03-06 Thread Terry Jones
I'm going to post a few short comments on deferreds. As a fun standalone warm-up exercise, here's an interview-style question for people who claim to understand Twisted's deferreds. What will the following code print, and why? from twisted.internet import defer def e_ok(x): prin

[Twisted-Python] A few comments on deferreds

2009-03-06 Thread Terry Jones
Here are a few comments on deferreds. I'll keep this short. These sort of posts don't seem to generate much/any discussion (e.g., http://bit.ly/YkSD which I thought was cool). I'm not sure why - I find deferreds infinitely interesting, and don't understand why other people don't seem to share the p

Re: [Twisted-Python] How to invoke the remote method based on twisted in django web app?

2009-03-06 Thread Phil Mayers
Boern wrote: hi,all: I developed a web app in diango and a remote service in twisted, and I want to invoke the twisted remote method in django web. example: the remote service code : class Echoer(pb.Root): def remote_echo(self, task): print 'echoing:', task

Re: [Twisted-Python] How to invoke the remote method based on twisted in django web app?

2009-03-06 Thread Burus
You can try starting reactor. in the settings.py file, and use twisted pb calls in the fjango views. On Fri, Mar 6, 2009 at 2:33 PM, Phil Mayers wrote: > Boern wrote: > >> hi,all: >> I developed a web app in diango and a remote service in twisted, and I >> want to invoke the twisted remote meth

Re: [Twisted-Python] A few comments on deferreds

2009-03-06 Thread Jean-Paul Calderone
On Fri, 6 Mar 2009 12:10:55 +0100, Terry Jones wrote: Here are a few comments on deferreds. I'll keep this short. These sort of posts don't seem to generate much/any discussion (e.g., http://bit.ly/YkSD which I thought was cool). I'm not sure why - I find deferreds infinitely interesting, and do

Re: [Twisted-Python] _Win32Waker

2009-03-06 Thread Jean-Paul Calderone
On Thu, 5 Mar 2009 16:49:15 -0600, Aron Bierbaum wrote: I have been using a custom Qt4 reactor that derives from PosixReactorBase. As a result it creates a _Win32Waker to allow threads and signals to wake up the IO thread. It seems though that the current implementation only works about half of

Re: [Twisted-Python] Re:how to pass on the connection failed or connection lost error

2009-03-06 Thread Jean-Paul Calderone
On Thu, 5 Mar 2009 15:49:31 -0800 (PST), khawar hasham wrote: Hi, I tried to use this suggestion but I could not make it work. here is the test I am using in my application class def callSend(self, msg):   plugin.send(msg) Now in plugin class def send(self, msg):   print 'before cal

Re: [Twisted-Python] A few comments on deferreds

2009-03-06 Thread Terry Jones
Hi JP > "JP" == Jean-Paul Calderone writes: JP> On Fri, 6 Mar 2009 12:10:55 +0100, Terry Jones wrote: >> 1. If you have a deferred d1, and you call d1.chainDeferred(d2) I think >> it makes sense for there to be a flag inside the deferred class that >> warns you if you later call d1.addCallb

Re: [Twisted-Python] sending large files from web2 http server

2009-03-06 Thread David Reid
On Thu, Mar 5, 2009 at 7:45 AM, Jean-Paul Calderone wrote: > On Thu, 05 Mar 2009 16:20:27 +0100, Markus Wanner > wrote: > >> Hi, >> >> I'm trying to stream longish data via web2, but experience sudden stalls >> in data transfer, followed by a connection abort after a certain >> timeout. I can't c

Re: [Twisted-Python] How to invoke the remote method based on twisted in django web app?

2009-03-06 Thread Boern
thanks,all. I have resolved it by twisted.web .xmprpc On Fri, Mar 6, 2009 at 7:44 PM, Burus wrote: > You can try starting reactor. in the settings.py file, and use twisted pb > calls in the fjango views. > > > On Fri, Mar 6, 2009 at 2:33 PM, Phil Mayers wrote: > >> Boern wrote: >> >>> hi,all: >