Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
105
Merge Requests
105
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
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):
elif
isinstance
(
instance
,
dict
):
result
=
{}
for
key
in
instance
.
keys
()
:
for
key
in
instance
:
result
[
key
]
=
_getDict
(
instance
[
key
])
return
result
else
:
try
:
result
=
{}
for
key
in
instance
.
__dict__
.
keys
():
result
[
key
]
=
_getDict
(
instance
.
__dict__
[
key
])
return
result
dikt
=
instance
.
__dict__
except
AttributeError
:
return
instance
result
=
{}
for
key
,
value
in
dikt
.
iteritems
():
result
[
key
]
=
_getDict
(
value
)
return
result
class
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