cast instead of rebuilding dict when returning lists of dicts
authorMark Huang <mlhuang@cs.princeton.edu>
Mon, 16 Oct 2006 19:18:31 +0000 (19:18 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Mon, 16 Oct 2006 19:18:31 +0000 (19:18 +0000)
PLC/Methods/GetAttributes.py
PLC/Methods/GetKeys.py
PLC/Methods/GetNodeGroups.py
PLC/Methods/GetNodes.py
PLC/Methods/GetPCUs.py
PLC/Methods/GetPersons.py
PLC/Methods/GetRoles.py
PLC/Methods/GetSites.py
PLC/Methods/GetSliceAttributes.py
PLC/Methods/GetSlices.py

index 5b5ea9f..8790e13 100644 (file)
@@ -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
index 80c4538..41a3ce2 100644 (file)
@@ -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
index 738f0ce..c9c0b62 100644 (file)
@@ -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
index 2b270d0..dafc53f 100644 (file)
@@ -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
index 60aabbb..17b9670 100644 (file)
@@ -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
index 1e3fa3b..a6fbc10 100644 (file)
@@ -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
index 6826476..084350f 100644 (file)
@@ -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
index 50d5e84..cb9847a 100644 (file)
@@ -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
index 38e887f..9d92c1e 100644 (file)
@@ -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
index 292de53..b87ee91 100644 (file)
@@ -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