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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
erp5
Commits
1ee39d03
Commit
1ee39d03
authored
Jun 08, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache getPhysicalPath as a volatile attribute.
parent
19e6cc3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
product/CMFActivity/ActivityTool.py
product/CMFActivity/ActivityTool.py
+16
-5
No files found.
product/CMFActivity/ActivityTool.py
View file @
1ee39d03
...
@@ -1033,12 +1033,23 @@ class ActivityTool (Folder, UniqueObject):
...
@@ -1033,12 +1033,23 @@ class ActivityTool (Folder, UniqueObject):
Intermediate level is unconditionaly created if non existant because
Intermediate level is unconditionaly created if non existant because
chances are it will be used in the instance life.
chances are it will be used in the instance life.
"""
"""
# Safeguard: make sure we are wrapped in acquisition context before
# XXX: using a volatile attribute to cache getPhysicalPath result.
# using our path as an activity tool instance-wide identifier.
# This cache may need invalidation if all the following is
assert
getattr
(
self
,
'aq_self'
,
None
)
is
not
None
# simultaneously true:
my_instance_key
=
self
.
getPhysicalPath
()
# - ActivityTool instances can be moved in object tree
my_thread_key
=
get_ident
()
# - moved instance is used to get access to its activity buffer
# - another instance is put in the place of the original, and used to
# access its activity buffer
# ...which seems currently unlikely, and as such is left out.
try
:
my_instance_key
=
self
.
_v_physical_path
except
AttributeError
:
# Safeguard: make sure we are wrapped in acquisition context before
# using our path as an activity tool instance-wide identifier.
assert
getattr
(
self
,
'aq_self'
,
None
)
is
not
None
self
.
_v_physical_path
=
my_instance_key
=
self
.
getPhysicalPath
()
thread_activity_buffer
=
global_activity_buffer
[
my_instance_key
]
thread_activity_buffer
=
global_activity_buffer
[
my_instance_key
]
my_thread_key
=
get_ident
()
try
:
try
:
return
thread_activity_buffer
[
my_thread_key
]
return
thread_activity_buffer
[
my_thread_key
]
except
KeyError
:
except
KeyError
:
...
...
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