Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Thomas Leymonerie
slapos.core
Commits
e477bfaa
Commit
e477bfaa
authored
Oct 09, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache heavy method.
parent
e96ef577
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+12
-5
No files found.
master/product/Vifib/Tool/SlapTool.py
View file @
e477bfaa
...
@@ -37,6 +37,7 @@ from Products.ERP5Type.Globals import InitializeClass
...
@@ -37,6 +37,7 @@ from Products.ERP5Type.Globals import InitializeClass
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Cache
import
DEFAULT_CACHE_SCOPE
from
Products.ERP5Type.Cache
import
DEFAULT_CACHE_SCOPE
from
Products.ERP5Type.Cache
import
CachingMethod
from
lxml
import
etree
from
lxml
import
etree
import
time
import
time
try
:
try
:
...
@@ -1111,15 +1112,21 @@ class SlapTool(BaseTool):
...
@@ -1111,15 +1112,21 @@ class SlapTool(BaseTool):
else
:
else
:
return
l
[
0
].
getObject
()
return
l
[
0
].
getObject
()
def
_getComputerDocument
(
self
,
computer_reference
):
def
_getNonCachedComputerDocument
(
self
,
computer_reference
):
"""
Get the validated computer with this reference.
"""
return
self
.
_getDocument
(
return
self
.
_getDocument
(
portal_type
=
'Computer'
,
portal_type
=
'Computer'
,
# XXX Hardcoded validation state
# XXX Hardcoded validation state
validation_state
=
"validated"
,
validation_state
=
"validated"
,
reference
=
computer_reference
)
reference
=
computer_reference
).
getRelativeUrl
()
def
_getComputerDocument
(
self
,
computer_reference
):
"""
Get the validated computer with this reference.
"""
result
=
CachingMethod
(
self
.
_getNonCachedComputerDocument
,
id
=
'_getComputerDocument'
,
cache_factory
=
'slap_cache_factory'
)(
computer_reference
)
return
self
.
getPortalObject
().
restrictedTraverse
(
result
)
@
UnrestrictedMethod
@
UnrestrictedMethod
def
_getComputerUidByReference
(
self
,
computer_reference
):
def
_getComputerUidByReference
(
self
,
computer_reference
):
...
...
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