Commit 1414754a authored by Jean-Paul Smets's avatar Jean-Paul Smets

Accelerate Web Pages.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12415 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 038c9af1
...@@ -40,6 +40,7 @@ from Acquisition import aq_base ...@@ -40,6 +40,7 @@ from Acquisition import aq_base
from DocumentTemplate.DT_Util import html_quote from DocumentTemplate.DT_Util import html_quote
from Products.CMFCore.WorkflowCore import WorkflowMethod from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.CMFCore.utils import _setCacheHeaders
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.File import File from Products.ERP5.Document.File import File
from OFS.Image import Image as OFSImage from OFS.Image import Image as OFSImage
...@@ -282,6 +283,8 @@ class Image(File, OFSImage): ...@@ -282,6 +283,8 @@ class Image(File, OFSImage):
"""Return the image data.""" """Return the image data."""
self._upradeImage() self._upradeImage()
_setCacheHeaders(self, dict(display=display, format=format, quality=quality, resolution=resolution))
# display may be set from a cookie (?) # display may be set from a cookie (?)
if (display is not None or resolution is not None or quality!=75 or format!='')\ if (display is not None or resolution is not None or quality!=75 or format!='')\
and defaultdisplays.has_key(display): and defaultdisplays.has_key(display):
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import _setCacheHeaders
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Document import Document from Products.ERP5.Document.Document import Document
from Products.ERP5Type.WebDAVSupport import TextContent from Products.ERP5Type.WebDAVSupport import TextContent
...@@ -100,6 +101,8 @@ class TextDocument(Document, TextContent): ...@@ -100,6 +101,8 @@ class TextDocument(Document, TextContent):
if format is None: if format is None:
# The default is to use ERP5 Forms to render the page # The default is to use ERP5 Forms to render the page
return self.view() return self.view()
# Accelerate rendering in Web mode
_setCacheHeaders(self, {'format' : format})
# Return the raw content # Return the raw content
if format == 'raw': if format == 'raw':
return self.getTextContent() return self.getTextContent()
...@@ -107,6 +110,10 @@ class TextDocument(Document, TextContent): ...@@ -107,6 +110,10 @@ class TextDocument(Document, TextContent):
return getToolByName(self, 'portal_transforms').convertTo(mime_type, return getToolByName(self, 'portal_transforms').convertTo(mime_type,
self.getTextContent(), object=self, mimetype=self.getTextFormat()) self.getTextContent(), object=self, mimetype=self.getTextFormat())
def __call__(self):
_setCacheHeaders(self, {})
return Document.__call__(self)
### Content indexing methods ### Content indexing methods
security.declareProtected(Permissions.View, 'getSearchableText') security.declareProtected(Permissions.View, 'getSearchableText')
def getSearchableText(self, md=None): def getSearchableText(self, md=None):
......
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