On Oct 10, 10:50 pm, jostheim <[EMAIL PROTECTED]> wrote:
> I have a weird one.  I am trying to serve a firefox xpi file (static
> file) and the content-type is being set to "text/plain" when the file
> is actually a sort of zip file.  This would be fine except that
> firefox interperts that content-type as something it should download,
> not install (I verified this serving the same static file using tomcat
> which does not set the content-type and where firefox dutifully
> installs the xpi file).  All I really need is for TG to not set the
> content-type at all (especially since it doesn't know what it is).
>
> How do I either let TG/Cherrypy know about this content-type and what
> to set it to or have TG stop setting content-types on unknown static
> files?  Or insert other workaround here.

If you look at the top of cherrypy/lib/cptools.py you'll see something
like:

import mimetypes
mimetypes.init()
mimetypes.types_map['.dwg']='image/x-dwg'
mimetypes.types_map['.ico']='image/x-icon'

You can add your own registered types to that (somewhere in your own
app):

import mimetypes
mimetypes.types_map['.xpi'] = 'application/x-xpinstall'

...or you could look at your platform's specific methods to register
types, and let mimetypes.init() pick it up that way.


Robert Brewer
[EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to