We have a page on our site that is intended to return plain-text only -- no html. The page consists of a dtml method that calls a single External method which, in turn, returns plain text read from a file. The page is read by a small client that uses HTTP to access the site. Since the file that the text comes from can be any file, it may, itself, contain html code. We've found that, in certain cases, if the plain text happens to include html tags, Zope will insert an empty html header at the beginning of the page. It contains only "<html><head></head>". We've tried setting the content type in the RESPONSE header to "text/plain", but it has no effect. Anyone know what's going on and how we can suppress it?
but it has no effect. Anyone know what's going on and how we can suppress it?
It may be a bug, because lib/python/ZPublisher and ZServer/HTTPResponse.py search for content-type using lowercase: if body: isHTML=self.isHTML(body) if not headers.has_key('content-type'): if isHTML: c='text/html' else: c='text/plain' self.setHeader('content-type',c) Who knows? (try to set the content type with lowercase letters) and tell us how it went. -Morten
but it has no effect. Anyone know what's going on and how we can suppress it?
It may be a bug, because lib/python/ZPublisher and ZServer/HTTPResponse.py search for content-type using lowercase:
if body: isHTML=self.isHTML(body) if not headers.has_key('content-type'): if isHTML: c='text/html' else: c='text/plain' self.setHeader('content-type',c)
Who knows? (try to set the content type with lowercase letters) and tell us how it went.
-Morten
That did the trick. Thanks for the help. This mailing list is great.
That did the trick. Thanks for the help. This mailing list is great.
Cool. I'll submit it as a bug on the Collector. <http://classic.zope.org:8080/Collector> -Morten
participants (2)
-
John Hile -
Morten W. Petersen