Commit 9b95699d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

apply caching policy manager in WebSection.__call__.

otherwise Web Section or Web Site without default Web Page does not contain cache related headers.
parent d2f1148f
......@@ -28,6 +28,7 @@
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Domain import Domain
from Products.ERP5.mixin.extensible_traversable import DocumentExtensibleTraversableMixin
......@@ -199,6 +200,7 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
We use REQUEST parameters so that they are reset for every
Web transaction and can be accessed from widgets.
"""
_setCacheHeaders(_ViewEmulator().__of__(self), {})
# Register current web site physical path for later URL generation
if self.REQUEST.get(self.web_section_key, MARKER) is MARKER:
self.REQUEST[self.web_section_key] = self.getPhysicalPath()
......
......@@ -433,8 +433,17 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
"""
request = self.portal.REQUEST
website = self.setupWebSite()
path = website.absolute_url_path()
response = self.publish(path)
self.assertTrue(response.getHeader('x-cache-headers-set-by'),
'CachingPolicyManager: /erp5/caching_policy_manager')
web_section_portal_type = 'Web Section'
web_section = website.newContent(portal_type=web_section_portal_type)
path = web_section.absolute_url_path()
response = self.publish(path)
self.assertTrue(response.getHeader('x-cache-headers-set-by'),
'CachingPolicyManager: /erp5/caching_policy_manager')
# unauthenticated
document_portal_type = 'Text'
......
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