# HG changeset patch
# User Jeff Hammel <jhammel@mozilla.com>
# Date 1335678939 25200
# Node ID 6bf4a58b0988512c226ed09d7761cb1d70b1e68c
# Parent  0804a706d6bfd715a7d6bf81c0df681fc5794764
make dump behave better

diff -r 0804a706d6bf -r 6bf4a58b0988 configuration/configuration.py
--- a/configuration/configuration.py	Sat Apr 28 15:29:57 2012 -0700
+++ b/configuration/configuration.py	Sat Apr 28 22:55:39 2012 -0700
@@ -272,8 +272,11 @@
         # add an option for dumping
         formats = self.formats()
         if formats and dump:
-            self.add_option(dump, dest='dump',
-                            help="dump configuration to a file; Formats: %s" % formats)
+            if isinstance(dump, basestring):
+                dump = [dump]
+            dump = list(dump)
+            self.add_option(*dump, dest='dump',
+                            help="Output configuration file; Formats: %s" % formats)
 
 
     ### methods for iteration
@@ -405,11 +408,6 @@
             # errors are handled below
             pass
 
-        # dump configuration, if specified
-        dump = getattr(options, 'dump')
-        if dump:
-            # TODO: have a way of specifying format other than filename
-            self.serialize(dump)
 
         if missingvalues and not dump:
             # XXX assuming if you don't have values you were just dumping
@@ -421,6 +419,13 @@
         # return parsed arguments
         return options, args
 
+    def dump(self, options):
+        """dump configuration, if specified"""
+        dump = getattr(options, 'dump')
+        if dump:
+            # TODO: have a way of specifying format other than filename
+            self.serialize(dump)
+
     ### serialization/deserialization
 
     def formats(self):