Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
01e450c1
Commit
01e450c1
authored
Dec 29, 2020
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFCoreUtils: use queryUtility instead of getToolByName to follow the code that is patched
parent
03adae28
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
product/ERP5Type/patches/CMFCoreUtils.py
product/ERP5Type/patches/CMFCoreUtils.py
+5
-4
No files found.
product/ERP5Type/patches/CMFCoreUtils.py
View file @
01e450c1
...
@@ -13,13 +13,14 @@
...
@@ -13,13 +13,14 @@
##############################################################################
##############################################################################
from
Acquisition
import
aq_parent
from
Acquisition
import
aq_parent
from
Products.CMFCore.utils
import
getToolByName
,
SUBTEMPLATE
from
Products.CMFCore.utils
import
SUBTEMPLATE
from
zope.component
import
queryUtility
from
Products.CMFCore.interfaces
import
ICachingPolicyManager
# patch _setCacheHeaders so that existing headers are not overridden
# patch _setCacheHeaders so that existing headers are not overridden
def
_setCacheHeaders
(
obj
,
extra_context
):
def
_setCacheHeaders
(
obj
,
extra_context
):
"""Set cache headers according to cache policy manager for the obj."""
"""Set cache headers according to cache policy manager for the obj."""
REQUEST
=
getattr
(
obj
,
'REQUEST'
,
None
)
REQUEST
=
getattr
(
obj
,
'REQUEST'
,
None
)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
call_count
=
getattr
(
REQUEST
,
SUBTEMPLATE
,
1
)
-
1
call_count
=
getattr
(
REQUEST
,
SUBTEMPLATE
,
1
)
-
1
setattr
(
REQUEST
,
SUBTEMPLATE
,
call_count
)
setattr
(
REQUEST
,
SUBTEMPLATE
,
call_count
)
...
@@ -30,7 +31,7 @@ def _setCacheHeaders(obj, extra_context):
...
@@ -30,7 +31,7 @@ def _setCacheHeaders(obj, extra_context):
delattr
(
REQUEST
,
SUBTEMPLATE
)
delattr
(
REQUEST
,
SUBTEMPLATE
)
content
=
aq_parent
(
obj
)
content
=
aq_parent
(
obj
)
manager
=
getToolByName
(
obj
,
'caching_policy_manager'
,
None
)
manager
=
queryUtility
(
ICachingPolicyManager
)
if
manager
is
None
:
if
manager
is
None
:
return
return
...
...
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