Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
erp5
Commits
52bdd068
Commit
52bdd068
authored
Sep 05, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply caching_policy_manager even if custom render method is used in Web Site or Web Section.
parent
5285a607
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
product/ERP5/Document/WebSection.py
product/ERP5/Document/WebSection.py
+4
-1
product/ERP5/tests/testERP5Web.py
product/ERP5/tests/testERP5Web.py
+15
-0
No files found.
product/ERP5/Document/WebSection.py
View file @
52bdd068
...
...
@@ -37,6 +37,7 @@ from AccessControl import Unauthorized
from
OFS.Traversable
import
NotFound
from
Persistence
import
Persistent
from
ZPublisher
import
BeforeTraverse
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
Products.ERP5Type.Cache
import
getReadOnlyTransactionCache
...
...
@@ -232,7 +233,9 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
if
custom_render_method_id
is
not
None
:
if
document
is
None
:
document
=
self
return
getattr
(
document
,
custom_render_method_id
)()
result
=
getattr
(
document
,
custom_render_method_id
)()
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
{})
return
result
elif
document
is
not
None
:
return
document
()
return
Domain
.
__call__
(
self
)
...
...
product/ERP5/tests/testERP5Web.py
View file @
52bdd068
...
...
@@ -1143,6 +1143,21 @@ Hé Hé Hé!""", page.asText().strip())
modification_date
=
rfc1123_date
(
document
.
getModificationDate
())
self
.
assertEqual
(
modification_date
,
last_modified_header
)
def
test_15a_CheckCachingPolicyManager
(
self
):
"""
Check if caching_policy_manager is well applied even if custom
render method is used in Web Site or Web Section.
"""
web_site
=
self
.
setupWebSite
()
web_section_portal_type
=
'Web Section'
web_section
=
web_site
.
newContent
(
portal_type
=
web_section_portal_type
)
self
.
assertTrue
(
self
.
publish
(
web_site
.
absolute_url_path
()).
getHeader
(
'X-Cache-Headers-Set-By'
))
web_site
.
setCustomRenderMethodId
(
'WebSection_viewAsWeb'
)
self
.
assertTrue
(
self
.
publish
(
web_site
.
absolute_url_path
()).
getHeader
(
'X-Cache-Headers-Set-By'
))
self
.
assertTrue
(
self
.
publish
(
web_section
.
absolute_url_path
()).
getHeader
(
'X-Cache-Headers-Set-By'
))
web_section
.
setCustomRenderMethodId
(
'WebSection_viewAsWeb'
)
self
.
assertTrue
(
self
.
publish
(
web_section
.
absolute_url_path
()).
getHeader
(
'X-Cache-Headers-Set-By'
))
def
test_16_404ErrorPageIsReturned
(
self
):
"""
Test that when we try to access a non existing url trought a web site, a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment