[Twisted-Python] Re: Twisted-Python Digest, Vol 33, Issue 6

Steve Han hxianping at gmail.com
Thu Dec 7 22:08:26 EST 2006


Thank you very much Robert.I have been using SuSE10.0 that contained
twisted.I could not find twisted when updating to SuSE10.1Wired.I am back to
suse10.0 again.I will learn more about twisted from now.

On 12/7/06, twisted-python-request at twistedmatrix.com <
twisted-python-request at twistedmatrix.com> wrote:
>
> Send Twisted-Python mailing list submissions to
>         twisted-python at twistedmatrix.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> or, via email, send a message with subject or body 'help' to
>         twisted-python-request at twistedmatrix.com
>
> You can reach the person managing the list at
>         twisted-python-owner at twistedmatrix.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Twisted-Python digest..."
>
>
> Today's Topics:
>
>    1. Re: web2: http Content-Length header (Pieter Grimmerink)
>    2. twisted dohop ( Atli ?orbj?rnsson )
>    3. Re: twisted dohop (Christopher Armstrong)
>    4. Re: web2: http Content-Length header (David Reid)
>    5. Problems with building of twisted-2.4.0 (Steve Han)
>    6. Re: Problems with building of twisted-2.4.0 (Robert Gravina)
>    7. Re: web2: http Content-Length header (Pieter Grimmerink)
>    8. Thread (Gabriel)
>    9. Re: Thread (Jean-Paul Calderone)
>   10. Re: web2: http Content-Length header (James Y Knight)
>   11. Re: web2: http Content-Length header (Pieter Grimmerink)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 5 Dec 2006 22:55:37 +0100
> From: Pieter Grimmerink <mailinglists at grimmerink.nl>
> Subject: Re: [Twisted-Python] web2: http Content-Length header
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <200612052255.37751.mailinglists at grimmerink.nl>
> Content-Type: text/plain;  charset="us-ascii"
>
> On Monday 04 December 2006 22:16, Pieter Grimmerink wrote:
> > Is it really necessary to remove the content-length header from the
> > response?
>
> Correction, it turns out indeed it has to be removed. If it isn't stripped
> from the response, somehow the download stops after a single block of data
> has been received.
>
> Since the content-length is saved in self.length, the following could be a
> workaround (and it does work fine here):
>
> Add the Content-Length header again after calling setConnectionParams, at
> the bottom of allHeadersReceived (line 195 twisted/web2/channel/http.py)
>
>   self.inHeaders.setHeader('Content-Length', str(self.length))
>
> What exactly goes wrong with setConnectionParams when the Content-Length
> header is not (temporarily) removed is not 100% clear to me, so there
> probably are better solutions for this problem.
>
> Regards, Pieter
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 5 Dec 2006 22:51:06 +0000
> From: " Atli ?orbj?rnsson " <atlithorn at gmail.com>
> Subject: [Twisted-Python] twisted dohop
> To: twisted-python at twistedmatrix.com
> Message-ID:
>         <91142a380612051451k441243f8vd438f5daf618c3f8 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> We would like to be added to the ProjectsUsingTwisted page. dohop.com is a
> flight planner and twisted runs what we call our "priceserver". The
> priceserver is under a substantial amount of load and twisted handles the
> job handsomely.
>
> Try it out at http://www.dohop.com
>
> The backend of the site runs otherwise almost wholly on Python with bits
> and
> pieces in C. We do a lot of django under mod_python with a mysql db.
>
> Hope you see us fit for a mention and thank you for the amazing framework
> that is twisted.
>
> Atli Thorbjornsson
> dohop.com
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://twistedmatrix.com/pipermail/twisted-python/attachments/20061205/ed12d2e0/attachment-0001.htm
>
> ------------------------------
>
> Message: 3
> Date: Tue, 5 Dec 2006 18:18:14 -0500
> From: "Christopher Armstrong" <radix at twistedmatrix.com>
> Subject: Re: [Twisted-Python] twisted dohop
> To: "Twisted general discussion" <twisted-python at twistedmatrix.com>
> Message-ID:
>         <60ed19d40612051518j3adf62c4hb73ce4b8abc2c4d at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> On 12/5/06, Atli Þorbjörnsson <atlithorn at gmail.com> wrote:
> > We would like to be added to the ProjectsUsingTwisted page. dohop.com is
> a
> > flight planner and twisted runs what we call our "priceserver". The
> > priceserver is under a substantial amount of load and twisted handles
> the
> > job handsomely.
> >
> > Try it out at http://www.dohop.com
>
> Ok, I've added it to the ProjectsUsingTwisted page, but really, this
> kind of thing (that is, a commercial service) would be much more
> appropriate on the SuccessStories page -- it would be great if you
> could give us a few official sentences about how Twisted helped you
> develop this service so we could put it there.
>
> --
> Christopher Armstrong
> International Man of Twistery
> http://radix.twistedmatrix.com/
> http://twistedmatrix.com/
> http://canonical.com/
>
> ------------------------------
>
> Message: 4
> Date: Tue, 5 Dec 2006 16:54:41 -0800
> From: David Reid <dreid at dreid.org>
> Subject: Re: [Twisted-Python] web2: http Content-Length header
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <48238A9C-A227-4816-991F-93FCA3F94C26 at dreid.org>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>
> On Dec 5, 2006, at 1:55 PM, Pieter Grimmerink wrote:
>
> > On Monday 04 December 2006 22:16, Pieter Grimmerink wrote:
> >> Is it really necessary to remove the content-length header from the
> >> response?
> >
> > Correction, it turns out indeed it has to be removed. If it isn't
> > stripped
> > from the response, somehow the download stops after a single block
> > of data
> > has been received.
> >
> > Since the content-length is saved in self.length, the following
> > could be a
> > workaround (and it does work fine here):
>
> Why don't you just use self.length when showing the progress?
> -David
>
> David Reid
> http://dreid.org/
>
>
>
>
>
> ------------------------------
>
> Message: 5
> Date: Wed, 6 Dec 2006 15:23:49 +0800
> From: "Steve Han" <hxianping at gmail.com>
> Subject: [Twisted-Python] Problems with building of twisted-2.4.0
> To: twisted-python <twisted-python at twistedmatrix.com>
> Message-ID:
>         <702805a90612052323t780ee7e5h326917b2ce44713b at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
> I am new to Twisted.When building ZopeInterface-3.1.0-0c1 got the messages
> as the following:
>
> ...build/temp.linux-i686-2.4/Dependencies/zope.interface-
> ZopeInterface-3.1.0c1/zope.interface/_zope_interface_coptimizations.o
> unable to execute gcc: No such file or directory
> error: command 'gcc' failed with exit status 1
>
> What does mean by that?
> Which packages I need for building Twisted/ZopeInterface?
> Thanks alot.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://twistedmatrix.com/pipermail/twisted-python/attachments/20061206/4a846c3c/attachment-0001.htm
>
> ------------------------------
>
> Message: 6
> Date: Wed, 6 Dec 2006 17:03:20 +0900
> From: Robert Gravina <robert at gravina.com>
> Subject: Re: [Twisted-Python] Problems with building of twisted-2.4.0
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <20140598-9163-4239-9729-FF91F103B914 at gravina.com>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> > Hi all,
> > I am new to Twisted.When building ZopeInterface-3.1.0-0c1 got the
> > messages as the following:
> >
> >  ...build/temp.linux-i686-2.4/Dependencies/zope.interface-
> > ZopeInterface-3.1.0c1/zope.interface/_zope_interface_coptimizations.o
> > unable to execute gcc: No such file or directory
> > error: command 'gcc' failed with exit status 1
> >
> > What does mean by that?
> > Which packages I need for building Twisted/ZopeInterface?
> > Thanks alot.
>
> It seems that you are running Linux, but don't have GCC (a C
> compiler) installed. Parts of Zope Interface (and Twisted, too) are
> written in C, so one is needed. Most Linux distributions install one
> automatically, but as far as I know some don't if you don't  ask it
> to install development software. Either that, or it's installed but
> not in your PATH.
>
> Anyhow, there should be a GUI program for adding/removing programs,
> so use it to install "gcc". If not,  and you are using Ubuntu or
> Debian "apt-get install gcc" or for Fedora try "yum install gcc" and
> then try building Twisted again.
>
> Please excuse me if you know all this already (you are building
> Twisted after all). It just seems like problem is that GCC is not
> installed/cannot be found.
>
> Robert
>
>
>
>
> ------------------------------
>
> Message: 7
> Date: Wed, 6 Dec 2006 10:35:11 +0100
> From: Pieter Grimmerink <mailinglists at grimmerink.nl>
> Subject: Re: [Twisted-Python] web2: http Content-Length header
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <200612061035.12521.mailinglists at grimmerink.nl>
> Content-Type: text/plain;  charset="us-ascii"
>
> On Wednesday 06 December 2006 01:54, David Reid wrote:
> > Why don't you just use self.length when showing the progress?
>
> The length is not passed to the Response object.
>
> twisted/web2/client/http.py line 168:
> self.response = http.Response(self.code, self.inHeaders, self.stream)
>
> This response object is then passed to the responseDefer callback, which
> means we only have resultcode, headers and stream to work with.
>
> Rgds, Pieter
>
>
>
> ------------------------------
>
> Message: 8
> Date: Wed, 6 Dec 2006 04:23:32 -0800
> From: Gabriel <gabrielverta at gmail.com>
> Subject: [Twisted-Python] Thread
> To: twisted-python at twistedmatrix.com
> Message-ID:
>         <2254669b0612060423t4f75043auef8424ab3b5e257f at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi!!
>
> I'm new in Twisted, and I'm having problems with Thread.
> I was looking for it at documentation, and saw that it's not safe
> (!?), but it's possible to run using twisted.python.threadable, I
> haven't understood the thread examples using simple TCP and
> ServerFactoryl, there is anything like reactor.run() using it or can I
> only use threads as client? Can anyone give me a basic example?
>
> Thanks!
>
> from Brazil...
>
>          Gabriel
> www.garimpar.com
>
>
>
> ------------------------------
>
> Message: 9
> Date: Wed, 6 Dec 2006 08:49:50 -0500
> From: Jean-Paul Calderone <exarkun at divmod.com>
> Subject: Re: [Twisted-Python] Thread
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID:
>         <20061206134950.20948.1512853559.divmod.quotient.60088 at ohm>
> Content-Type: text/plain; format=flowed
>
> On Wed, 6 Dec 2006 04:23:32 -0800, Gabriel <gabrielverta at gmail.com> wrote:
> >Hi!!
> >
> >I'm new in Twisted, and I'm having problems with Thread.
> >I was looking for it at documentation, and saw that it's not safe
> >(!?), but it's possible to run using twisted.python.threadable, I
> >haven't understood the thread examples using simple TCP and
> >ServerFactoryl, there is anything like reactor.run() using it or can I
> >only use threads as client? Can anyone give me a basic example?
> >
> >Thanks!
> >
> >from Brazil...
> >
> >         Gabriel
> >www.garimpar.com
> >
>
> You don't need threads to do most things in Twisted.  More than that,
> threads aren't /helpful/ for doing most things in Twisted.  More than
> that, most of Twisted was written so that threads could be avoided.
>
> Jean-Paul
>
>
>
> ------------------------------
>
> Message: 10
> Date: Wed, 6 Dec 2006 11:23:24 -0500
> From: James Y Knight <foom at fuhm.net>
> Subject: Re: [Twisted-Python] web2: http Content-Length header
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <1869B98D-5F03-49E0-9084-80771CE346F2 at fuhm.net>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>
> On Dec 6, 2006, at 4:35 AM, Pieter Grimmerink wrote:
>
> > On Wednesday 06 December 2006 01:54, David Reid wrote:
> >> Why don't you just use self.length when showing the progress?
> >
> > The length is not passed to the Response object.
> >
> > twisted/web2/client/http.py line 168:
> > self.response = http.Response(self.code, self.inHeaders, self.stream)
> >
> > This response object is then passed to the responseDefer callback,
> > which
> > means we only have resultcode, headers and stream to work with.
>
> Sorry for not responding before. The Content-Length is removed from
> the set of headers and moved to an attribute of the stream. This is
> so that if anybody does content transforms before you get the data
> (e.g. transparent uncompressing/etc), the length and the data is in
> the same place, among other reasons.
>
> You're supposed to get the length from the stream object.
> stream.length is an integer if the content length is known, and None
> if it is not known.
>
> James
>
>
>
>
> ------------------------------
>
> Message: 11
> Date: Wed, 6 Dec 2006 18:39:40 +0100
> From: Pieter Grimmerink <mailinglists at grimmerink.nl>
> Subject: Re: [Twisted-Python] web2: http Content-Length header
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <200612061839.40844.mailinglists at grimmerink.nl>
> Content-Type: text/plain;  charset="us-ascii"
>
> On Wednesday 06 December 2006 17:23, James Y Knight wrote:
> > You're supposed to get the length from the stream object.
> > stream.length is an integer if the content length is known, and None
> > if it is not known.
>
> But stream.length is always None, even though the Content-Length is
> specified.
>
> Pasted below is an example which demonstrates what I'm doing.
> This is the response I'm getting:
>
> <twisted.web2.http.Response code=302, streamlen=None>
>
> And this is the response, when I add the line
>
> self.stream.length = self.length
>
> in twisted/web2/client/http.py, line 168:
>
> <twisted.web2.http.Response code=302, streamlen=228>
>
> Rgds, Pieter
>
> ---------------------------------------------------
>
> from twisted.internet import protocol
> from twisted.web2 import stream as stream_mod, http, http_headers,
> responsecode
> from twisted.web2.client.http import ClientRequest, HTTPClientProtocol
>
> def testConn(host):
>     from twisted.internet import reactor
>     d = protocol.ClientCreator(reactor,
> HTTPClientProtocol).connectTCP(host,
> 80)
>     def gotResp(resp):
>         def print_(n):
>             print "DATA"
>         def printdone(n):
>             print "DONE"
>         print "GOT RESPONSE %s" % resp
>         stream_mod.readStream(resp.stream, print_).addCallback(printdone)
>     def sendReqs(proto):
>         proto.submitRequest(ClientRequest("GET", "/index.html",
> {'Host':host}, None)).addCallback(gotResp)
>     d.addCallback(sendReqs)
>     del d
>     reactor.run()
>
> testConn("www.google.com")
>
>
>
> ------------------------------
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
> End of Twisted-Python Digest, Vol 33, Issue 6
> *********************************************
>



-- 
Steve Han
Tel:(0531)82704691   13864091826
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20061208/60c4a37f/attachment.htm 


More information about the Twisted-Python mailing list