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
Jérome Perrin
slapos.core
Commits
ba9b05f2
Commit
ba9b05f2
authored
Jan 23, 2012
by
Vincent Pelletier
Committed by
Romain Courteaud
Jan 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use adequate iteration methods.
Also, reduce the scope of one more try..except block.
parent
3650d673
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
slapos/format.py
slapos/format.py
+6
-7
No files found.
slapos/format.py
View file @
ba9b05f2
...
@@ -141,20 +141,19 @@ def _getDict(instance):
...
@@ -141,20 +141,19 @@ def _getDict(instance):
elif
isinstance
(
instance
,
dict
):
elif
isinstance
(
instance
,
dict
):
result
=
{}
result
=
{}
for
key
in
instance
.
keys
()
:
for
key
in
instance
:
result
[
key
]
=
_getDict
(
instance
[
key
])
result
[
key
]
=
_getDict
(
instance
[
key
])
return
result
return
result
else
:
else
:
try
:
try
:
dikt
=
instance
.
__dict__
result
=
{}
for
key
in
instance
.
__dict__
.
keys
():
result
[
key
]
=
_getDict
(
instance
.
__dict__
[
key
])
return
result
except
AttributeError
:
except
AttributeError
:
return
instance
return
instance
result
=
{}
for
key
,
value
in
dikt
.
iteritems
():
result
[
key
]
=
_getDict
(
value
)
return
result
class
Computer
:
class
Computer
:
"Object representing the computer"
"Object representing the computer"
...
...
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