Skip to content

Commit 45c0806

Browse files
author
Elias Nygren
committed
use a python 2.6 compatible dict comprehension
1 parent 2a3c966 commit 45c0806

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

upcloud_api/server.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ def save(self):
9292
use add_IP, add_storage, remove_IP, remove_storage instead.
9393
"""
9494

95-
kwargs = {
96-
field: getattr(self, field)
95+
# dict comprehension that also works with 2.6
96+
# http://stackoverflow.com/questions/21069668/alternative-to-dict-comprehension-prior-to-python-2-7
97+
kwargs = dict(
98+
(field, getattr(self, field))
9799
for field in self.updateable_fields
98100
if hasattr(self, field)
99-
}
101+
)
100102

101103
self.cloud_manager.modify_server(self.uuid, **kwargs)
102104
self._reset(kwargs)

0 commit comments

Comments
 (0)