From 5c10b06bd3eb270477033093876c69315262d763 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 19 Sep 2006 19:19:46 +0000 Subject: [PATCH] - value returned is now xml-rpc safe --- PLC/Methods/AdmGetAllNodeNetworks.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/PLC/Methods/AdmGetAllNodeNetworks.py b/PLC/Methods/AdmGetAllNodeNetworks.py index a1fd3a84..48f2cb7b 100644 --- a/PLC/Methods/AdmGetAllNodeNetworks.py +++ b/PLC/Methods/AdmGetAllNodeNetworks.py @@ -22,7 +22,7 @@ class AdmGetAllNodeNetworks(Method): Node.fields['hostname']) ] - returns = [NodeNetwork.all_fields] + #returns = [NodeNetwork.all_fields] def call(self, auth, node_id_or_hostname): # Authenticated function @@ -40,4 +40,12 @@ class AdmGetAllNodeNetworks(Method): raise PLCInvalidArgument, "Node has no node networks" nodenetworks = NodeNetworks(self.api, nodenetwork_ids).values() - return nodenetworks + # 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 NodeNetwork.all_fields and value is not None + nodenetworks = [dict(filter(valid_return_fields_only, nodenetwork.items())) \ + for nodenetwork in nodenetworks] + + + return nodenetworks -- 2.47.0