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
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bryan Kaperick
erp5
Commits
65ae7d9f
Commit
65ae7d9f
authored
Nov 21, 2014
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Type.patches.OFSItem: Explicitly declare volatileCached public.
parent
253200f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
product/ERP5Type/patches/OFSItem.py
product/ERP5Type/patches/OFSItem.py
+5
-2
No files found.
product/ERP5Type/patches/OFSItem.py
View file @
65ae7d9f
from
AccessControl
import
ClassSecurityInfo
from
OFS.SimpleItem
import
SimpleItem
"""
...
...
@@ -14,6 +15,8 @@ NOTE: This patches OFS.Item.SimpleItem as it's the lowest patchable class
before persistence.Persistent, where this patch would actually belong.
"""
security
=
ClassSecurityInfo
()
security
.
declarePublic
(
'volatileCached'
)
def
volatileCached
(
self
,
func
):
"""
Cache "func()" return value using a volatile on self.
...
...
@@ -40,7 +43,7 @@ def volatileCached(self, func):
# volatile property anyway.
self
.
_v_SimpleItem_Item_vCache
=
cache_dict
=
{}
# Use whole func_code as a key, as it is the only reliable way to identify a
# function
reliably
.
# function.
key
=
func
.
func_code
try
:
return
cache_dict
[
key
]
...
...
@@ -49,4 +52,4 @@ def volatileCached(self, func):
return
value
SimpleItem
.
volatileCached
=
volatileCached
security
.
apply
(
SimpleItem
)
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