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
18
Merge Requests
18
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
d5ad7822
Commit
d5ad7822
authored
Jul 07, 2022
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Mar 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Add getSoftwareInstanceObject to Slapos Catalog Tool Mixin
parent
f55a8d27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
4 deletions
+49
-4
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.py
...rtal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.py
+25
-1
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.xml
...tal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.xml
+24
-3
No files found.
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.py
View file @
d5ad7822
...
@@ -30,7 +30,6 @@ from OFS.Traversable import NotFound
...
@@ -30,7 +30,6 @@ from OFS.Traversable import NotFound
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
class
SlapOSCatalogToolCacheMixin
(
object
):
class
SlapOSCatalogToolCacheMixin
(
object
):
""" Quering Caching Extension for Catalog for handle specific queries
""" Quering Caching Extension for Catalog for handle specific queries
relying on caching.
relying on caching.
...
@@ -92,3 +91,28 @@ class SlapOSCatalogToolCacheMixin(object):
...
@@ -92,3 +91,28 @@ class SlapOSCatalogToolCacheMixin(object):
(
compute_node_reference
,
compute_partition_reference
)
(
compute_node_reference
,
compute_partition_reference
)
else
:
else
:
return
_assertACI
(
compute_partition_list
[
0
].
getObject
())
return
_assertACI
(
compute_partition_list
[
0
].
getObject
())
def
_getNonCachedSoftwareInstance
(
self
,
reference
,
include_shared
=
False
):
# No need to get all results if an error is raised when at least 2 objects
# are found
if
not
include_shared
:
portal_type
=
"Software Instance"
else
:
portal_type
=
(
"Software Instance"
,
"Slave Instance"
)
software_instance_list
=
self
.
unrestrictedSearchResults
(
limit
=
2
,
portal_type
=
portal_type
,
validation_state
=
"validated"
,
reference
=
reference
)
if
len
(
software_instance_list
)
!=
1
:
raise
NotFound
,
"No document found with parameters: %s"
%
reference
else
:
return
_assertACI
(
software_instance_list
[
0
].
getObject
()).
getRelativeUrl
()
def
getSoftwareInstanceObject
(
self
,
reference
,
include_shared
=
False
):
"""
Get the validated compute_node with this reference.
"""
result
=
CachingMethod
(
self
.
_getNonCachedSoftwareInstance
,
id
=
'_getSoftwareInstanceObject'
,
cache_factory
=
'slap_cache_factory'
)(
reference
,
include_shared
=
include_shared
)
return
self
.
getPortalObject
().
restrictedTraverse
(
result
)
\ No newline at end of file
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.xml
View file @
d5ad7822
...
@@ -6,6 +6,12 @@
...
@@ -6,6 +6,12 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SlapOSCatalogToolCacheMixin
</string>
</value>
<value>
<string>
SlapOSCatalogToolCacheMixin
</string>
</value>
...
@@ -55,13 +61,28 @@
...
@@ -55,13 +61,28 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -74,7 +95,7 @@
...
@@ -74,7 +95,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -83,7 +104,7 @@
...
@@ -83,7 +104,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
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