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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
01f28f67
Commit
01f28f67
authored
Jan 23, 2012
by
Vincent Pelletier
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
023c0a9f
Changes
1
Show 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 @
01f28f67
...
...
@@ -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