changeset 95:290c40224e5d

improved abstraction; sadly doesnt seem to work
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 29 Apr 2012 00:30:58 -0700
parents 291fbbeb6e1e
children bfe4234ee6f4
files configuration/configuration.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/configuration/configuration.py	Sat Apr 28 23:25:52 2012 -0700
+++ b/configuration/configuration.py	Sun Apr 29 00:30:58 2012 -0700
@@ -409,11 +409,7 @@
             pass
 
         # dump configuration
-        self.dump(options)
-
-        if missingvalues and not getattr(options, 'dump', None):
-            # XXX assuming if you don't have values you were just dumping
-            self.error(str(missingvalues))
+        dump = self.dump(options, missingvalues)
 
         # update options from config
         options.__dict__.update(self.config)
@@ -421,13 +417,15 @@
         # return parsed arguments
         return options, args
 
-    def dump(self, options):
+    def dump(self, options, missingvalues):
         """dump configuration, if specified"""
 
         dump = getattr(options, 'dump')
         if dump:
             # TODO: have a way of specifying format other than filename
             self.serialize(dump)
+        elif missingvalues:
+            self.error(str(missingvalues))
 
     ### serialization/deserialization