[Twisted-web] Setting the twcgi header?

Sergio Trejo serj_trejo at hotmail.com
Mon Jul 12 02:12:10 MDT 2004

I'm quite new to Twisted and Twisted.web but have been playing around with 
it the past several days and enjoying my new learning experience. Please 
someone correct me if I'm wrong, but can't you just write out the 
Content-Type, etc. to a Resource instance by overriding its render_GET() 
method (e.g., request.write())?

from twisted.web.resource import Resource

class myResource(Resource):
   isLeaf = True
   def render_GET(self, request):

    # see API documentation for:
    #  write(self,  data)
    #  Write some data as a result of an HTTP request.



>From: "Alex Newby" <alex at alexnewby.com>
>Reply-To: "Discussion of twisted.web, Nevow,and Woven" 
><twisted-web at twistedmatrix.com>
>To: "Twisted-Web" <twisted-web at twistedmatrix.com>
>Subject: [Twisted-web] Setting the twcgi header?
>Date: Sun, 11 Jul 2004 11:00:02 -0700
>class PythonCGI(twcgi.FilteredScript):
>         filter = '/usr/local/bin/python'
>I wish to set the following header for my PythonCGI:
>print "Content-type: application/x-shockwave-flash\n\n"
>But, instead the script renders:
>Connection: close
>Content-type: text/html
>Server: TwistedWeb/1.3.0rc1
>How do I change the header?
>Alex Newby
>E-mail: alex at alexnewby.com
>Website: http://www.alexnewby.com
>Twisted-web mailing list
>Twisted-web at twistedmatrix.com

Protect your PC - get McAfee.com VirusScan Online 

More information about the Twisted-web mailing list