From: Mark Huang <mlhuang@cs.princeton.edu>
Date: Mon, 16 Oct 2006 19:18:31 +0000 (+0000)
Subject: cast instead of rebuilding dict when returning lists of dicts
X-Git-Tag: pycurl-7_13_1~557
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=575d12792527ae98ff6ed22de3594ca39e03bc84;p=plcapi.git

cast instead of rebuilding dict when returning lists of dicts
---

diff --git a/PLC/Methods/GetAttributes.py b/PLC/Methods/GetAttributes.py
index 5b5ea9f7..8790e131 100644
--- a/PLC/Methods/GetAttributes.py
+++ b/PLC/Methods/GetAttributes.py
@@ -25,6 +25,6 @@ class GetAttributes(Method):
         attributes = Attributes(self.api, attribute_id_or_name_list).values()
 	
 	# Turn each attribute into a real dict.
-	attributes = [dict(attribute.items()) for attribute in attributes]
+	attributes = [dict(attribute) for attribute in attributes]
 
         return attributes
diff --git a/PLC/Methods/GetKeys.py b/PLC/Methods/GetKeys.py
index 80c45381..41a3ce22 100644
--- a/PLC/Methods/GetKeys.py
+++ b/PLC/Methods/GetKeys.py
@@ -34,6 +34,6 @@ class GetKeys(Method):
 	keys = Keys(self.api, key_id_list).values()
 	
 	# Turn each key into a real dict
-	keys = [dict(key.items()) for key in keys]
+	keys = [dict(key) for key in keys]
 		
         return keys
diff --git a/PLC/Methods/GetNodeGroups.py b/PLC/Methods/GetNodeGroups.py
index 738f0ced..c9c0b62e 100644
--- a/PLC/Methods/GetNodeGroups.py
+++ b/PLC/Methods/GetNodeGroups.py
@@ -26,6 +26,6 @@ class GetNodeGroups(Method):
 	nodegroups = NodeGroups(self.api, nodegroup_id_or_name_list).values()
 
 	# Turn each nodegroup into a real dict.
-        nodegroups = [dict(nodegroup.items()) for nodegroup in nodegroups]
+        nodegroups = [dict(nodegroup) for nodegroup in nodegroups]
 
         return nodegroups
diff --git a/PLC/Methods/GetNodes.py b/PLC/Methods/GetNodes.py
index 2b270d0d..dafc53f0 100644
--- a/PLC/Methods/GetNodes.py
+++ b/PLC/Methods/GetNodes.py
@@ -47,6 +47,6 @@ class GetNodes(Method):
         nodes = Nodes(self.api, node_id_or_hostname_list).values()
 
         # turn each node into a real dict.
-        nodes = [dict(node.items()) for node in nodes]
+        nodes = [dict(node) for node in nodes]
                     
         return nodes
diff --git a/PLC/Methods/GetPCUs.py b/PLC/Methods/GetPCUs.py
index 60aabbb1..17b9670f 100644
--- a/PLC/Methods/GetPCUs.py
+++ b/PLC/Methods/GetPCUs.py
@@ -34,6 +34,6 @@ class GetPCUs(Method):
         pcus = PCUs(self.api, pcu_ids).values()
 
 	# turn each pcu into a real dict
-	pcus = [dict(pcu.items()) for pcu in pcus]
+	pcus = [dict(pcu) for pcu in pcus]
 
 	return pcus
diff --git a/PLC/Methods/GetPersons.py b/PLC/Methods/GetPersons.py
index 1e3fa3bc..a6fbc103 100644
--- a/PLC/Methods/GetPersons.py
+++ b/PLC/Methods/GetPersons.py
@@ -62,6 +62,6 @@ class GetPersons(Method):
         persons = filter(self.caller.can_view, persons.values())
 
         # Turn each person into a real dict.
-        persons = [dict(person.items()) for person in persons]
+        persons = [dict(person) for person in persons]
                     
         return persons
diff --git a/PLC/Methods/GetRoles.py b/PLC/Methods/GetRoles.py
index 68264763..084350f8 100644
--- a/PLC/Methods/GetRoles.py
+++ b/PLC/Methods/GetRoles.py
@@ -22,6 +22,6 @@ class GetRoles(Method):
 	roles = Roles(self.api).values()
 
 	#turn each role into a real dict
-	roles = [dict(role.items()) for role in roles]
+	roles = [dict(role) for role in roles]
 
 	return roles
diff --git a/PLC/Methods/GetSites.py b/PLC/Methods/GetSites.py
index 50d5e84b..cb9847a9 100644
--- a/PLC/Methods/GetSites.py
+++ b/PLC/Methods/GetSites.py
@@ -40,6 +40,6 @@ class GetSites(Method):
         sites = Sites(self.api, site_id_or_login_base_list)
 
         # turn each site into a real dict.
-        sites = [dict(site.items()) for site in sites.values()]
+        sites = [dict(site) for site in sites.values()]
 	
         return sites
diff --git a/PLC/Methods/GetSliceAttributes.py b/PLC/Methods/GetSliceAttributes.py
index 38e887fc..9d92c1e5 100644
--- a/PLC/Methods/GetSliceAttributes.py
+++ b/PLC/Methods/GetSliceAttributes.py
@@ -53,7 +53,7 @@ class GetSliceAttributes(Method):
 
         slice_attributes = SliceAttributes(self.api, slice_attribute_id_list).values()
 	# turn each slice attribute into a real dict
-	slice_attributes = [dict(slice_attribute.items()) \
+	slice_attributes = [dict(slice_attribute) \
 			   for slice_attribute in slice_attributes]
 	
         return slice_attributes
diff --git a/PLC/Methods/GetSlices.py b/PLC/Methods/GetSlices.py
index 292de531..b87ee91f 100644
--- a/PLC/Methods/GetSlices.py
+++ b/PLC/Methods/GetSlices.py
@@ -43,6 +43,6 @@ class GetSlices(Method):
             slices = filter(can_view, slices)
 
 	# turn each slice into a real dict
-	slices = [dict(slice.items()) for slice in slices]
+	slices = [dict(slice) for slice in slices]
 
         return slices