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
Léo-Paul Géneau
slapos.core
Commits
82ee4990
Commit
82ee4990
authored
Jul 07, 2022
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Add getSoftwareInstanceObject to Slapos Catalog Tool Mixin
parent
8f5b25f4
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 @
82ee4990
...
...
@@ -30,7 +30,6 @@ from OFS.Traversable import NotFound
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
class
SlapOSCatalogToolCacheMixin
(
object
):
""" Quering Caching Extension for Catalog for handle specific queries
relying on caching.
...
...
@@ -92,3 +91,28 @@ class SlapOSCatalogToolCacheMixin(object):
(
compute_node_reference
,
compute_partition_reference
)
else
:
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 @
82ee4990
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SlapOSCatalogToolCacheMixin
</string>
</value>
...
...
@@ -55,13 +61,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +95,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +104,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</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