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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
cf879a85
Commit
cf879a85
authored
Aug 14, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5/Extensions: Remote unused extension
parent
25b79436
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
34 deletions
+0
-34
product/ERP5/Extensions/CachePageTemplate.py
product/ERP5/Extensions/CachePageTemplate.py
+0
-34
No files found.
product/ERP5/Extensions/CachePageTemplate.py
deleted
100644 → 0
View file @
25b79436
from
Products.ERP5Type.Globals
import
get_request
import
time
from
zLOG
import
LOG
CACHE_DURATION
=
600
cached_template
=
{}
expires_date
=
{}
def
getCachedPageTemplate
(
self
,
id
=
None
,
REQUEST
=
None
):
global
cached_template
global
expires_date
if
id
is
not
None
:
# Get the user id and request
if
not
REQUEST
:
REQUEST
=
get_request
()
user_id
=
self
.
portal_membership
.
getAuthenticatedMember
().
getIdOrUserName
()
key
=
(
user_id
,
id
)
# lookup the cache for time
now
=
time
.
time
()
# if cache exists and time is OK, return cache
expires
=
expires_date
.
get
(
key
,
now
)
if
expires
>
now
:
LOG
(
'CACHED:'
,
0
,
str
(
id
))
return
cached_template
[
key
]
# else recompute cache
method
=
getattr
(
self
,
id
,
None
)
if
method
is
not
None
:
cached_template
[
key
]
=
method
(
REQUEST
=
REQUEST
)
expires_date
[
key
]
=
now
+
CACHE_DURATION
return
cached_template
[
key
]
else
:
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