[Twisted-Python] Twisted and ipython

2011-01-11 Thread Alessandro Dentella
Hi, I'm starting a project where I plan to use twisted for the first time. I'd like to practice using ipython and after looking around I found a recepe [1] by Metthew Scott and a comment by Bob Ippolito on that recepe that suggests a different approch [2]. In the ipython manual there's a referenc

[Twisted-Python] client connecting to 2 servers (non simultaneously)

2011-01-11 Thread benjamin.bertrand
Hi, I'm new to twisted and I have started to write a new protocol with a TCP client and server. In my protocol, a client should be able to connect to 2 servers (master/slave node - only the master accepts connection). The client should try to connect to server1. If it fails, try to connect to serv

Re: [Twisted-Python] client connecting to 2 servers (non simultaneously)

2011-01-11 Thread Jason Rennie
You could probably generalize and simplify by using a collections.deque of hosts/ports and using the rotate() method before each reactor.connectTCP. Also, no need for multiple reactor imports---one at the top of the code is fine. Note that if the connection is "lost" in a non-clean fashion, you m

Re: [Twisted-Python] Twisted and PEP 3148 support

2011-01-11 Thread exarkun
On 03:10 am, screwt...@froup.com wrote: >>Futures may call their callbacks in any thread. So the line: >> > d.fail(e) >> >>must instead be something like: >> >> reactor.callFromThread(d.errback, e) > >PEP 3148 says: ># Added callables are called in the order that th

Re: [Twisted-Python] client connecting to 2 servers (non simultaneously)

2011-01-11 Thread Itamar Turner-Trauring
On Tue, 2011-01-11 at 11:17 +0100, benjamin.bertr...@lfv.se wrote: > Any comments is welcome. It's probably better to use one factory per client connection - easier to distinguish between connections. Not strictly necessary, though. ___ Twisted-Python

Re: [Twisted-Python] client connecting to 2 servers (non simultaneously)

2011-01-11 Thread Kevin Horn
Using a deque for this is a fantastic idea, though I would have used rotate(-1), as your example looks like it rotate's "backwards" to me. Matter of taste I suppose. It doesn't make much actual difference. Kevin Horn On Tue, Jan 11, 2011 at 7:11 AM, Jason Rennie wrote: > You could probably ge

Re: [Twisted-Python] client connecting to 2 servers (non simultaneously)

2011-01-11 Thread Jason Rennie
I agree that rotate(-1) is more intuitive. I barely gave it any thought---almost forgot to include an argument for rotate as I initially incorrectly assumed no argument would do something like rotate(-1) :-) Jason On Tue, Jan 11, 2011 at 1:36 PM, Kevin Horn wrote: > Using a deque for this is a

Re: [Twisted-Python] Twisted and ICP protocol

2011-01-11 Thread Richard Wall
On Mon, Jan 10, 2011 at 9:29 PM, Roberto Franchesco wrote: > I have been trying to get a squid proxy to "talk" to a twisted proxy > and I came across an old email from this list where someone mentioned > that they had implemented a basic ICP protocol in twisted. > Does anyone still have that imple