[Twisted-Python] Static file filenames and MIME types...

Christopher Armstrong radix at twistedmatrix.com
Tue Jun 10 21:45:06 EDT 2003

On 2003.06.10 21:33, Stuart Hungerford wrote:
> Hi all,
> I think these questions show my ignorance of HTTP request headers
> as much has anything, but:
> In a twisted.web based application I'm returning a file in a resource
> render() call via the twisted.web.static.File class.
> If I've understood right, it's possible to specify the MIME type
> of the file in the static.file constructor call.  Between this
> setting and a request.setHeader('Content-Type', 'foo') call which
> one takes priority?

The parameter that File takes is _default_Type, which just specifies 
which type to send (using request.setHeader) when no mime type can be
inferred from the extension of the file. So static.File itself does
request.setHeader('content-type', ...) (as well as 'content-encoding').

 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+     http://twistedmatrix.com/users/radix.twistd/

More information about the Twisted-Python mailing list