Commit 6ebf2d09 authored by 's avatar

Fixed Content-Type divination in DTMLMethods & docs.

parent 1b596117
......@@ -84,7 +84,7 @@
##############################################################################
"""DTML Document objects."""
__version__='$Revision: 1.24 $'[11:-2]
__version__='$Revision: 1.25 $'[11:-2]
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
from ZPublisher.Converters import type_converters
from Globals import HTML, HTMLFile, MessageDialog
......@@ -181,17 +181,15 @@ class DTMLDocument(DTMLMethod, PropertyManager):
return self.raise_standardErrorMessage(client, REQUEST)
if RESPONSE is None: return r
# Try to handle content types intelligently...
hh=RESPONSE.headers.has_key
if not (hh('content-type') or hh('Content-Type')):
if self.__dict__.has_key('content_type'):
c=self.content_type
else:
c, e=guess_content_type(self.__name__, r)
RESPONSE.setHeader('Content-Type', c)
return r
# We don't allow document to set headers
return decapitate(r, RESPONSE)
......
......@@ -84,7 +84,7 @@
##############################################################################
"""DTML Method objects."""
__version__='$Revision: 1.23 $'[11:-2]
__version__='$Revision: 1.24 $'[11:-2]
from Globals import HTML, HTMLFile, MessageDialog
from string import join,split,strip,rfind,atoi,lower
......@@ -160,11 +160,10 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
if RESPONSE is None: return r
# This was bad for dynamic content!
# RESPONSE.setHeader('Last-Modified', rfc1123_date(self._p_mtime))
# Ick. I don't like this. But someone can override it with
# a header if they have to.
hh=RESPONSE.headers.has_key
if not (hh('content-type') or hh('Content-Type')):
c, e=guess_content_type(self.__name__, r)
RESPONSE.setHeader('Content-Type', c)
return decapitate(r, RESPONSE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment