Re: [Twisted-Python] Best way to trigger a future connection with data

2013-07-22 Thread Laurens Van Houtven
Hi Nick

On Mon, Jul 22, 2013 at 10:40 AM, Nick Johnson nick.john...@ed.ac.ukwrote:

 Hi,

 Firstly, thanks for this gist, I had done a few experiments using
 endpoints and I think this is definitely the way to go for this code.


Welcome :)


 As to the questions: source and destination are parameters for the job
 and might change between runs (a function I didn't include for brevity
 handles computation of these). Interval was to be the time passed to
 LoopingCall and type_req was another job parameter.

 I agree that, having looked at the gist, trying to pack everything into
 one Protocol was not the best way to go and using a separate protocol
 for each type of communication (ie, getjob, retrievejob) is more sensible.


For what it's worth: a protocol implementing all of these might make even
more sense if you have some functions as the high level API (like the ones
I wrote in the gist): the functions could call high level methods on the
protocol that cause it to do certain things.

As an example, consider the IRCClient protocol:
https://twistedmatrix.com/documents/current/api/twisted.words.protocols.irc.IRCClient.html

... which has methods like join, leave, say, message...


 Thanks for helping me out with this, Twisted is slowly starting to make
 sense now.

 Cheers,
 -Nick.


 On 19/07/13 14:52, Laurens Van Houtven wrote:
  Hi Nick,
 
 
  Okay, question and code review time. Why are source and destination
  arguments to the protocol? Can't they just access it on the factory?
 
  It seems that the factory initiates many connections with the same
  parameters. Is that true? Does it only ever make sense to use the
  factory to fire many requests?
 
  Anyway, the biggest issue seems to be that you're stuck on trying to do
  everything with one protocol; it might make total sense for you to have
  a job-queueing and a job-getting protocol :)
 
  Can you explain what the interval and type_req arguments are, and why
  they're passed to the factory?
 
  cheers
  lvh
 

 --
 The University of Edinburgh is a charitable body, registered in
 Scotland, with registration number SC005336.


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] SQL ORM for Twisted PostgreSQL?

2013-07-22 Thread Glyph

On Jul 19, 2013, at 1:21 AM, Laurens Van Houtven _...@lvh.io wrote:

 On Fri, Jul 19, 2013 at 9:06 AM, Hynek Schlawack h...@ox.cx wrote:
 How would you feel about packaging it up on PyPI so people can try it out 
 effortlessly? What do Apple’s licenses say about that? Yes, I’m volunteering.
  
 It seems it's released under the ASL2. I don't know if Apple prevents *its* 
 employees from doing anything in particular, but it seems like third party 
 contributors are free to do with it as they please (within the limits of the 
 license, of course). 

There are actually bits of this that I've been meaning to contribute back for a 
long time.  If somebody would like to help me out with it then maybe I can eke 
out a little bit of time to do it - I've just been pretty busy :-).

-glyph___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and Qt5

2013-07-22 Thread Glyph

On Jul 20, 2013, at 5:04 AM, Burak Nehbit bu...@nehbit.net wrote:

 Is there such a thing for Qt5? Is it planned?

Well, it sounds like you're planning it, so, I guess so :).

I doubt that anyone on this list has plans to do it (or there would already be 
work qt5 work done in the qt reactor repository) but there are plenty of people 
(myself included) who would be very happy to help you learn enough about 
Twisted to do it yourself.  And, honestly, if you're motivated to do it it's 
probably *not* a huge amount of effort to update the implementation.  Feel free 
to ask any questions you have on this list.

In the meanwhile though, maybe you could report a bug to Nokia or Trolltech or 
whoever runs Qt development right now that they should stop gratuitously 
breaking interfaces between versions?  We've had (at least one) major rewrite 
of the Qt reactor for every version of Qt, which seem to come out relatively 
frequently.  Nothing about the nature of event loops or sockets has changed 
sufficiently in the meanwhile to justify the constant re-work that Qt seems to 
require from us.

-glyph

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Don't Finalize Connection

2013-07-22 Thread Thomas Hommers
Hi,

i am fairly new to twisted and try to work my way trough the documentation.
There is a problem I can't find a solution for. Maybe somebody can give me a 
hint or point me into the right direction.

I am trying to create a TCP server. The client connects to the server, then the 
server will send multiple commands and binary data to the client. After the 
data has been send, the connection should stay open.

I subclass Protocol to create my protocol.
It seems that after i send data with self.transport.write(data) the last packet 
will be send with the FP. flag, what seems to Finalize the connection from 
this end.

Is there a way to force twisted to just Push my data, but not to Finalize 
the connection?

Thanks.

Thomas
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python