changeset 935:5b2d2f1f05d0

memory: bug fix the current local_dir after sat.conf is auto-updated
author souliane <souliane@mailoo.org>
date Mon, 24 Mar 2014 16:43:08 +0100
parents 34dd9287dfe5
children 6404df5305e3
files src/memory/memory.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/memory/memory.py	Mon Mar 24 16:21:14 2014 +0100
+++ b/src/memory/memory.py	Mon Mar 24 16:43:08 2014 +0100
@@ -163,10 +163,12 @@
                 target_file = BaseDirectory.save_config_path('sat') + '/sat.conf'
             config.set('', 'local_dir', old_default)
             with open(target_file, 'wb') as configfile:
-                config.write(configfile)
+                config.write(configfile)  # for the next time that user launches sat
             warning(_("Auto-update: local_dir set to %(path)s in the file %(config_file)s") % {'path': old_default, 'config_file': file_})
+            default = old_default
         else:  # use the new default local_dir
-            self.config.set('', 'local_dir', C.DEFAULT_LOCAL_DIR)
+            default = C.DEFAULT_LOCAL_DIR
+        self.config.set('', 'local_dir', default)  # for the currently running instance
 
     def getConfig(self, section, name):
         """Get the main configuration option