libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [01/11] libcloud git commit: perform runtime check for python version to support iteration
Date Tue, 27 Dec 2016 08:26:43 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 3e14f05a1 -> f13933ed7


perform runtime check for python version to support iteration


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a0ad69eb
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a0ad69eb
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a0ad69eb

Branch: refs/heads/trunk
Commit: a0ad69ebb6a9f325becd0358603f7a7415295b60
Parents: e91e66c
Author: Samuel Chong <samuelchong1@gmail.com>
Authored: Thu Dec 22 16:45:01 2016 +1100
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Tue Dec 27 19:22:04 2016 +1100

----------------------------------------------------------------------
 libcloud/compute/drivers/dimensiondata.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a0ad69eb/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index 1ce61dc..4619b1b 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -4056,7 +4056,12 @@ class DimensionDataNodeDriver(NodeDriver):
                     "ex_tagid_value_pairs must be a dictionary."
                 )
 
-            for k, v in ex_tagid_value_pairs.items():
+            if sys.version_info[0] < 3:
+                tagid_items = ex_tagid_value_pairs.iteritems()
+            else:
+                tagid_items = ex_tagid_value_pairs.items()
+
+            for k, v in tagid_items:
                 tag_elem = ET.SubElement(server_uncustomized_elm, 'tagById')
                 ET.SubElement(tag_elem, 'tagKeyId').text = k
 
@@ -4069,7 +4074,12 @@ class DimensionDataNodeDriver(NodeDriver):
                     "ex_tagname_value_pairs must be a dictionary"
                 )
 
-            for k, v in ex_tagname_value_pairs.items():
+            if sys.version_info[0] < 3:
+                tags_items = ex_tagname_value_pairs.iteritems()
+            else:
+                tags_items = ex_tagname_value_pairs.items()
+
+            for k, v in tags_items:
                 tag_name_elem = ET.SubElement(server_uncustomized_elm, 'tag')
                 ET.SubElement(tag_name_elem, 'tagKeyName').text = k
 


Mime
View raw message