Commit 1b05b014 authored by Alexandre Boeglin's avatar Alexandre Boeglin

Use _ViewEmulator in _setCacheHeaders, as it expects an action, not an object


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20643 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9130216d
...@@ -34,7 +34,7 @@ from Globals import get_request ...@@ -34,7 +34,7 @@ from Globals import get_request
from AccessControl import ClassSecurityInfo, Unauthorized from AccessControl import ClassSecurityInfo, Unauthorized
from Products.ERP5Type.Base import WorkflowMethod from Products.ERP5Type.Base import WorkflowMethod
from Products.CMFCore.utils import getToolByName, _checkPermission from Products.CMFCore.utils import getToolByName, _checkPermission
from Products.CMFCore.utils import _setCacheHeaders from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.TextDocument import TextDocument from Products.ERP5.Document.TextDocument import TextDocument
from Products.ERP5.Document.File import File from Products.ERP5.Document.File import File
...@@ -307,7 +307,7 @@ class EmailDocument(File, TextDocument): ...@@ -307,7 +307,7 @@ class EmailDocument(File, TextDocument):
Convert text using portal_transforms Convert text using portal_transforms
""" """
# Accelerate rendering in Web mode # Accelerate rendering in Web mode
_setCacheHeaders(self, {'format' : format}) _setCacheHeaders(_ViewEmulator().__of__(self), {'format' : format})
# Return the raw content # Return the raw content
if format == 'raw': if format == 'raw':
return 'text/plain', self.getTextContent() return 'text/plain', self.getTextContent()
......
...@@ -39,7 +39,7 @@ from AccessControl import ClassSecurityInfo ...@@ -39,7 +39,7 @@ from AccessControl import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
from DocumentTemplate.DT_Util import html_quote from DocumentTemplate.DT_Util import html_quote
from Products.CMFCore.utils import _setCacheHeaders from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator
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 Products.ERP5.Document.Document import ConversionError from Products.ERP5.Document.Document import ConversionError
...@@ -333,8 +333,8 @@ class Image(File, OFSImage): ...@@ -333,8 +333,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, _setCacheHeaders(_ViewEmulator().__of__(self), dict(display=display,
resolution=resolution, frame=frame)) format=format, quality=quality, resolution=resolution, frame=frame))
# 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 != ''\
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Base import WorkflowMethod from Products.ERP5Type.Base import WorkflowMethod
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import _setCacheHeaders from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator
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
...@@ -150,7 +150,7 @@ class TextDocument(Document, TextContent): ...@@ -150,7 +150,7 @@ class TextDocument(Document, TextContent):
Convert text using portal_transforms Convert text using portal_transforms
""" """
# Accelerate rendering in Web mode # Accelerate rendering in Web mode
_setCacheHeaders(self, {'format' : format}) _setCacheHeaders(_ViewEmulator().__of__(self), {'format' : format})
# Return the raw content # Return the raw content
if format == 'raw': if format == 'raw':
return 'text/plain', self.getTextContent() return 'text/plain', self.getTextContent()
...@@ -171,7 +171,7 @@ class TextDocument(Document, TextContent): ...@@ -171,7 +171,7 @@ class TextDocument(Document, TextContent):
return mime_type, '' return mime_type, ''
def __call__(self): def __call__(self):
_setCacheHeaders(self, {}) _setCacheHeaders(_ViewEmulator().__of__(self), {})
return Document.__call__(self) return Document.__call__(self)
security.declareProtected(Permissions.AccessContentsInformation, 'getContentBaseURL') security.declareProtected(Permissions.AccessContentsInformation, 'getContentBaseURL')
......
...@@ -36,7 +36,8 @@ from AccessControl import Unauthorized ...@@ -36,7 +36,8 @@ from AccessControl import Unauthorized
from OFS.Image import Pdata from OFS.Image import Pdata
from OFS.Image import File as OFSFile from OFS.Image import File as OFSFile
from OFS.content_types import guess_content_type from OFS.content_types import guess_content_type
from Products.CMFCore.utils import getToolByName, _setCacheHeaders from Products.CMFCore.utils import getToolByName, _setCacheHeaders,\
_ViewEmulator
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
...@@ -170,7 +171,7 @@ class OOoDocument(PermanentURLMixIn, File, ConversionCacheMixin): ...@@ -170,7 +171,7 @@ class OOoDocument(PermanentURLMixIn, File, ConversionCacheMixin):
by calling getTargetFormatItemList. by calling getTargetFormatItemList.
""" """
# Accelerate rendering in Web mode # Accelerate rendering in Web mode
_setCacheHeaders(self, {'format' : format}) _setCacheHeaders(_ViewEmulator().__of__(self), {'format' : format})
# Verify that the format is acceptable (from permission point of view) # Verify that the format is acceptable (from permission point of view)
method = self._getTypeBasedMethod('checkConversionFormatPermission', method = self._getTypeBasedMethod('checkConversionFormatPermission',
......
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