From: Tony Mack Date: Tue, 19 Sep 2006 19:36:29 +0000 (+0000) Subject: - value returned is now xml-rpc safe X-Git-Tag: pycurl-7_13_1~739 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=14387b662d2e3746997bf5edd63d963eb963295b;p=plcapi.git - value returned is now xml-rpc safe --- diff --git a/PLC/Methods/AdmGetNodeGroups.py b/PLC/Methods/AdmGetNodeGroups.py index 6ceaba8e..e6a81bea 100644 --- a/PLC/Methods/AdmGetNodeGroups.py +++ b/PLC/Methods/AdmGetNodeGroups.py @@ -34,7 +34,7 @@ class AdmGetNodeGroups(Method): assert self.caller is not None # Get nodes in this nodegroup - nodegroups = NodeGroups(self.api, nodegroup_id_or_name_list) + nodegroups = NodeGroups(self.api, nodegroup_id_or_name_list).values() # make sure sites are found if not nodegroups: @@ -44,4 +44,11 @@ class AdmGetNodeGroups(Method): elif not len(nodegroups) == len(nodegroup_id_or_name_list): raise PLCInvalidArgument, "at least one node group id is invalid" - return nodegroups.values() + # Filter out undesired or None fields (XML-RPC cannot marshal + # None) and turn each node into a real dict. + valid_return_fields_only = lambda (key, value): \ + key in NodeGroup.all_fields and value is not None + nodegroups = [dict(filter(valid_return_fields_only, nodegroup.items())) \ + for nodegroup in nodegroups] + + return nodegroups