[Zope] wrong content-type from Z Search Interface

Jordan B. Baker jbb@spyderlab.com
Wed, 5 Jan 2000 16:45:45 -0500 (EST)


On Tue, 4 Jan 2000 menezes@curiango.ipen.br wrote:

> Hi,
> 
> 	I'm having some strange problems with a Z Search Interface.
> 	With some queries it returns wrong content-type 
> (octect-stream instead of text/html).
> 	How can I fix this?
> 	Where is the problem: dtml-code sligth modified by me 
> (most aestetical changes) or sql data returned by MySQL?
> 	The problem is reproductible: whenever I try some keywords,
> I get a download prompt instead a html rendered page.

I had the same problem.  Using the source I managed to track down the
source of the error to a piece of code that guesses the MIME type of the
document.

Relevant files in the source are OFS/DTMLDocument/Method.py and
OFS/content_types.py

Basically what appears to happen is that some SQL queries return what is
considered bianry data by Zope resulting in a page that isn't visble to
the user if they are running certain browsers.

Looking at the code in DTMLMethod.py it appears that you can override the
mime type by setting RESPONSE.headers['content-type'] to 'text/html' but I
haven't tried this (though I am glad I looked now).

This was really confusing when I first encountered it though.  While I
appreciate it automatically guessing mime types it should maybe be a bit
more forgiving somehow.

Anyway, I hope this helps.

-j.

-------
Jordan B. Baker -- jbb@spyderlab.com
weaving the web @ http://www.spyderlab.com