comparison src/memory/memory.py @ 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 cbf4122baae7
children 71926ec2114d
comparison
equal deleted inserted replaced
934:34dd9287dfe5 935:5b2d2f1f05d0
161 if not target_file: 161 if not target_file:
162 # ... otherwise we create a new config file for that user 162 # ... otherwise we create a new config file for that user
163 target_file = BaseDirectory.save_config_path('sat') + '/sat.conf' 163 target_file = BaseDirectory.save_config_path('sat') + '/sat.conf'
164 config.set('', 'local_dir', old_default) 164 config.set('', 'local_dir', old_default)
165 with open(target_file, 'wb') as configfile: 165 with open(target_file, 'wb') as configfile:
166 config.write(configfile) 166 config.write(configfile) # for the next time that user launches sat
167 warning(_("Auto-update: local_dir set to %(path)s in the file %(config_file)s") % {'path': old_default, 'config_file': file_}) 167 warning(_("Auto-update: local_dir set to %(path)s in the file %(config_file)s") % {'path': old_default, 'config_file': file_})
168 default = old_default
168 else: # use the new default local_dir 169 else: # use the new default local_dir
169 self.config.set('', 'local_dir', C.DEFAULT_LOCAL_DIR) 170 default = C.DEFAULT_LOCAL_DIR
171 self.config.set('', 'local_dir', default) # for the currently running instance
170 172
171 def getConfig(self, section, name): 173 def getConfig(self, section, name):
172 """Get the main configuration option 174 """Get the main configuration option
173 @param section: section of the config file (None or '' for DEFAULT) 175 @param section: section of the config file (None or '' for DEFAULT)
174 @param name: name of the option 176 @param name: name of the option