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
Labels
Merge Requests
19
Merge Requests
19
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
60dab2e8
Commit
60dab2e8
authored
Oct 10, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise catalog usage and avoid needless security calculation.
parent
af4b9236
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+10
-10
No files found.
master/product/Vifib/Tool/SlapTool.py
View file @
60dab2e8
...
...
@@ -153,7 +153,7 @@ class SlapTool(BaseTool):
slap_computer
.
_computer_partition_list
=
[]
slap_computer
.
_software_release_list
=
\
self
.
_getSoftwareReleaseValueListForComputer
(
computer_id
,
full
=
full
)
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
(
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
parent_uid
=
parent_uid
,
validation_state
=
"validated"
,
portal_type
=
"Computer Partition"
):
...
...
@@ -199,7 +199,7 @@ class SlapTool(BaseTool):
computer_id
,
user
,
full
)
def
_getComputerInformation
(
self
,
computer_id
,
user
,
full
):
user_document
=
self
.
getPortalObject
().
portal_catalog
.
g
etResultValue
(
user_document
=
self
.
getPortalObject
().
portal_catalog
.
unrestrictedG
etResultValue
(
reference
=
user
,
portal_type
=
[
'Person'
,
'Computer'
,
'Software Instance'
])
user_type
=
user_document
.
getPortalType
()
self
.
REQUEST
.
response
.
setHeader
(
'Content-Type'
,
'text/xml'
)
...
...
@@ -226,7 +226,7 @@ class SlapTool(BaseTool):
return
self
.
_getCacheComputerInformation
(
computer_id
,
user
,
full
)
else
:
slap_computer
.
_software_release_list
=
[]
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
(
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
parent_uid
=
parent_uid
,
validation_state
=
"validated"
,
portal_type
=
"Computer Partition"
):
...
...
@@ -537,7 +537,7 @@ class SlapTool(BaseTool):
software_instance
=
None
if
computer_partition_document
.
getSlapState
()
==
'busy'
:
software_instance_list
=
portal
.
portal_catalog
(
software_instance_list
=
portal
.
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
"Software Instance"
,
default_aggregate_uid
=
computer_partition_document
.
getUid
(),
validation_state
=
"validated"
,
...
...
@@ -669,7 +669,7 @@ class SlapTool(BaseTool):
software_instance
=
None
if
computer_partition_document
.
getSlapState
()
==
'busy'
:
software_instance_list
=
portal
.
portal_catalog
(
software_instance_list
=
portal
.
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
"Software Instance"
,
default_aggregate_uid
=
computer_partition_document
.
getUid
(),
validation_state
=
"validated"
,
...
...
@@ -1106,7 +1106,7 @@ class SlapTool(BaseTool):
def
_getDocument
(
self
,
**
kwargs
):
# No need to get all results if an error is raised when at least 2 objects
# are found
l
=
self
.
getPortalObject
().
portal_catalog
(
limit
=
2
,
**
kwargs
)
l
=
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
limit
=
2
,
**
kwargs
)
if
len
(
l
)
!=
1
:
raise
NotFound
,
"No document found with parameters: %s"
%
kwargs
else
:
...
...
@@ -1150,7 +1150,7 @@ class SlapTool(BaseTool):
raise
Unauthorized
def
_getSoftwareInstallationForComputer
(
self
,
url
,
computer_document
):
software_installation_list
=
self
.
getPortalObject
().
portal_catalog
(
software_installation_list
=
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
'Software Installation'
,
default_aggregate_uid
=
computer_document
.
getUid
(),
validation_state
=
'validated'
,
...
...
@@ -1191,7 +1191,7 @@ class SlapTool(BaseTool):
else
:
query_kw
[
'reference'
]
=
slave_reference
software_instance
=
self
.
getPortalObject
().
portal_catalog
.
g
etResultValue
(
**
query_kw
)
software_instance
=
self
.
getPortalObject
().
portal_catalog
.
unrestrictedG
etResultValue
(
**
query_kw
)
if
software_instance
is
None
:
raise
NotFound
,
"No software instance found for: %s - %s"
%
(
computer_id
,
computer_partition_id
)
...
...
@@ -1215,7 +1215,7 @@ class SlapTool(BaseTool):
slave_instance_list
=
[]
if
(
software_instance
.
getPortalType
()
==
"Software Instance"
):
append
=
slave_instance_list
.
append
slave_instance_sql_list
=
portal
.
portal_catalog
(
slave_instance_sql_list
=
portal
.
portal_catalog
.
unrestrictedSearchResults
(
default_aggregate_uid
=
computer_partition
.
getUid
(),
portal_type
=
'Slave Instance'
,
validation_state
=
"validated"
,
...
...
@@ -1253,7 +1253,7 @@ class SlapTool(BaseTool):
computer_document
=
self
.
_getComputerDocument
(
computer_reference
)
portal
=
self
.
getPortalObject
()
software_release_list
=
[]
for
software_installation
in
portal
.
portal_catalog
(
for
software_installation
in
portal
.
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
'Software Installation'
,
default_aggregate_uid
=
computer_document
.
getUid
(),
validation_state
=
'validated'
,
...
...
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