[Twisted-Python] Mime Types ins static.File

cpaul at telemetrybox.org cpaul at telemetrybox.org
Tue Mar 5 00:29:57 MST 2002


Aloha,

Today I shut down Apache on my workstation and started using twisted.web on port 80 - everything is sailing smooth, I even have a startup script in rc.d.  The only issue I am running into so far has to do with mime types. 

In static, mime types are defined by the dictionary File.contentTypes - Is there an elegant way to dynamically set the mime types at mktap time?  Or would it be better to hack static.py to use Python's mimetypes module along with a common mime.types file? 

I am currently using: 

	contentTypes = mimetypes.read_mime_types('/usr/pkg/etc/httpd/mime.types') 

for my default mime types dictionary (this mime.types is from Apache).  This is obviously not a cross-platform solution.  By default, a NetBSD machine does not come with a mime.types database, instead it has to be installed with Apache or Netscape.  

Would it make sense for Twisted to come with it's own mime.types file? 


Thanks,
Charles




More information about the Twisted-Python mailing list