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
1
Merge Requests
1
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
Romain Courteaud
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):
...
@@ -50,23 +50,40 @@ class SoftwareInstance(Item):
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
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
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSlaXmlAsDict'
)
'getSlaXmlAsDict'
)
def
getSlaXmlAsDict
(
self
):
def
getSlaXmlAsDict
(
self
):
"""Returns SLA XML as python dictionary"""
"""Returns SLA XML as python dictionary"""
re
sult_dict
=
{}
re
turn
self
.
_getXmlAsDict
(
self
.
getSlaXml
())
xml
=
self
.
getSlaXml
()
if
xml
is
not
None
and
xml
!=
''
:
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
tree
=
etree
.
fromstring
(
xml
.
encode
(
'utf-8'
)
)
'getInstanceXmlAsDict'
)
for
element
in
tree
.
findall
(
'parameter'
):
def
getInstanceXmlAsDict
(
self
):
key
=
element
.
get
(
'id'
)
"""Returns Instance XML as python dictionary"""
value
=
result_dict
.
get
(
key
,
None
)
return
self
.
_getXmlAsDict
(
self
.
getTextContent
()
)
if
value
is
not
None
:
value
=
value
+
' '
+
element
.
text
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
else
:
'getConnectionXmlAsDict'
)
value
=
element
.
text
def
getConnectionXmlAsDict
(
self
):
result_dict
[
key
]
=
value
"""Returns Connection XML as python dictionary"""
return
result_dict
return
self
.
_getXmlAsDict
(
self
.
getConnectionXml
())
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'checkNotCyclic'
)
'checkNotCyclic'
)
...
...
master/bt5/vifib_base/bt/revision
View file @
4c838a5f
401
402
\ No newline at end of file
\ 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