New login command (that saves your login, too)
[mw] / src / mw / metadir.py
index 18811db26b38359b8adca2c71d517d53ad29895e..b637b67a6a7024da56e1c30f67e5ce6a20b20c34 100644 (file)
@@ -49,6 +49,10 @@ class Metadir(object):
         else:
             self.config = None
 
         else:
             self.config = None
 
+    def save_config(self):
+        with open(self.config_loc, 'wb') as config_file:
+            self.config.write(config_file)
+
     def create(self, api_url):
         # create the directory
         if os.path.isdir(self.location):
     def create(self, api_url):
         # create the directory
         if os.path.isdir(self.location):
@@ -64,8 +68,7 @@ class Metadir(object):
         self.config = ConfigParser.RawConfigParser()
         self.config.add_section('remote')
         self.config.set('remote', 'api_url', api_url)
         self.config = ConfigParser.RawConfigParser()
         self.config.add_section('remote')
         self.config.set('remote', 'api_url', api_url)
-        with open(self.config_loc, 'wb') as config_file:
-            self.config.write(config_file)
+        self.save_config()
         # create cache/
         os.mkdir(os.path.join(self.location, 'cache'))
         # create cache/pagedict
         # create cache/
         os.mkdir(os.path.join(self.location, 'cache'))
         # create cache/pagedict

Benjamin Mako Hill || Want to submit a patch?