If a value is None, there's no point exporting it in the relevant dict
representation for an object: it will be None again when the object is
loaded by FromDict. This has the nice side effect of removing
"deprecated" slots from the config file.

Signed-off-by: Guido Trotter <[email protected]>
---
 lib/objects.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/objects.py b/lib/objects.py
index 6be372b..b6526fc 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -126,7 +126,8 @@ class ConfigObject(object):
     make sure all objects returned are only standard python types.
 
     """
-    return dict([(k, getattr(self, k, None)) for k in self.__slots__])
+    return dict([(k, getattr(self, k, None)) for k in self.__slots__
+                 if getattr(self, k, None) is not None])
 
   @classmethod
   def FromDict(cls, val):
-- 
1.5.6.5

Reply via email to