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
Xavier Thompson
slapos.core
Commits
4c838a5f
Commit
4c838a5f
authored
Mar 01, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add methods to fetch XMLs as dicts.
parent
ddd08eef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
14 deletions
+31
-14
master/bt5/vifib_base/DocumentTemplateItem/SoftwareInstance.py
...r/bt5/vifib_base/DocumentTemplateItem/SoftwareInstance.py
+30
-13
master/bt5/vifib_base/bt/revision
master/bt5/vifib_base/bt/revision
+1
-1
No files found.
master/bt5/vifib_base/DocumentTemplateItem/SoftwareInstance.py
View file @
4c838a5f
...
...
@@ -50,23 +50,40 @@ class SoftwareInstance(Item):
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
def
_getXmlAsDict
(
self
,
xml
):
result_dict
=
{}
if
xml
is
None
or
xml
==
''
:
return
result_dict
tree
=
etree
.
fromstring
(
xml
.
encode
(
'utf-8'
))
for
element
in
tree
.
findall
(
'parameter'
):
key
=
element
.
get
(
'id'
)
value
=
result_dict
.
get
(
key
,
None
)
if
value
is
not
None
:
value
=
value
+
' '
+
element
.
text
else
:
value
=
element
.
text
result_dict
[
key
]
=
value
return
result_dict
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSlaXmlAsDict'
)
def
getSlaXmlAsDict
(
self
):
"""Returns SLA XML as python dictionary"""
re
sult_dict
=
{}
xml
=
self
.
getSlaXml
()
if
xml
is
not
None
and
xml
!=
''
:
tree
=
etree
.
fromstring
(
xml
.
encode
(
'utf-8'
)
)
for
element
in
tree
.
findall
(
'parameter'
):
key
=
element
.
get
(
'id'
)
value
=
result_dict
.
get
(
key
,
None
)
if
value
is
not
None
:
value
=
value
+
' '
+
element
.
text
else
:
value
=
element
.
text
result_dict
[
key
]
=
value
return
result_dict
re
turn
self
.
_getXmlAsDict
(
self
.
getSlaXml
())
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getInstanceXmlAsDict'
)
def
getInstanceXmlAsDict
(
self
):
"""Returns Instance XML as python dictionary"""
return
self
.
_getXmlAsDict
(
self
.
getTextContent
()
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getConnectionXmlAsDict'
)
def
getConnectionXmlAsDict
(
self
):
"""Returns Connection XML as python dictionary"""
return
self
.
_getXmlAsDict
(
self
.
getConnectionXml
())
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'checkNotCyclic'
)
...
...
master/bt5/vifib_base/bt/revision
View file @
4c838a5f
401
\ No newline at end of file
402
\ No newline at end of file
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