Commit 6ebf2d09 authored by 's avatar

Fixed Content-Type divination in DTMLMethods & docs.

parent 1b596117
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""DTML Document objects.""" """DTML Document objects."""
__version__='$Revision: 1.24 $'[11:-2] __version__='$Revision: 1.25 $'[11:-2]
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
from ZPublisher.Converters import type_converters from ZPublisher.Converters import type_converters
from Globals import HTML, HTMLFile, MessageDialog from Globals import HTML, HTMLFile, MessageDialog
...@@ -181,17 +181,15 @@ class DTMLDocument(DTMLMethod, PropertyManager): ...@@ -181,17 +181,15 @@ class DTMLDocument(DTMLMethod, PropertyManager):
return self.raise_standardErrorMessage(client, REQUEST) return self.raise_standardErrorMessage(client, REQUEST)
if RESPONSE is None: return r if RESPONSE is None: return r
# Try to handle content types intelligently... hh=RESPONSE.headers.has_key
if self.__dict__.has_key('content_type'): if not (hh('content-type') or hh('Content-Type')):
c=self.content_type if self.__dict__.has_key('content_type'):
else: c=self.content_type
c, e=guess_content_type(self.__name__, r) else:
c, e=guess_content_type(self.__name__, r)
RESPONSE.setHeader('Content-Type', c) RESPONSE.setHeader('Content-Type', c)
return r return r
# We don't allow document to set headers
return decapitate(r, RESPONSE)
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""DTML Method objects.""" """DTML Method objects."""
__version__='$Revision: 1.23 $'[11:-2] __version__='$Revision: 1.24 $'[11:-2]
from Globals import HTML, HTMLFile, MessageDialog from Globals import HTML, HTMLFile, MessageDialog
from string import join,split,strip,rfind,atoi,lower from string import join,split,strip,rfind,atoi,lower
...@@ -160,13 +160,12 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager, ...@@ -160,13 +160,12 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
if RESPONSE is None: return r 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 # Ick. I don't like this. But someone can override it with
# a header if they have to. # a header if they have to.
c, e=guess_content_type(self.__name__, r) hh=RESPONSE.headers.has_key
RESPONSE.setHeader('Content-Type', c) 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) return decapitate(r, RESPONSE)
def get_size(self): def get_size(self):
......
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