comparison src/tools/config.py @ 1409:3265a2639182

massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
author souliane <souliane@mailoo.org>
date Thu, 16 Apr 2015 14:57:57 +0200
parents 069ad98b360d
children ddc7a39ff9d1
comparison
equal deleted inserted replaced
1408:8a7145138330 1409:3265a2639182
44 config = SafeConfigParser() 44 config = SafeConfigParser()
45 target_file = None 45 target_file = None
46 for file_ in C.CONFIG_FILES[::-1]: 46 for file_ in C.CONFIG_FILES[::-1]:
47 # we will eventually update the existing file with the highest priority, if it's a user personal file... 47 # we will eventually update the existing file with the highest priority, if it's a user personal file...
48 if not silent: 48 if not silent:
49 log.debug(_("Testing file %s") % file_) 49 log.debug(_(u"Testing file %s") % file_)
50 if os.path.isfile(file_): 50 if os.path.isfile(file_):
51 if file_.startswith(os.path.expanduser('~')): 51 if file_.startswith(os.path.expanduser('~')):
52 config.read([file_]) 52 config.read([file_])
53 target_file = file_ 53 target_file = file_
54 break 54 break
61 with open(target_file, 'wb') as configfile: 61 with open(target_file, 'wb') as configfile:
62 config.write(configfile) # for the next time that user launches sat 62 config.write(configfile) # for the next time that user launches sat
63 if not silent: 63 if not silent:
64 if option in ('passphrase',): # list here the options storing a password 64 if option in ('passphrase',): # list here the options storing a password
65 value = '******' 65 value = '******'
66 log.warning(_("Config auto-update: %(option)s set to %(value)s in the file %(config_file)s") % 66 log.warning(_(u"Config auto-update: %(option)s set to %(value)s in the file %(config_file)s") %
67 {'option': option, 'value': value, 'config_file': target_file}) 67 {'option': option, 'value': value, 'config_file': target_file})
68 68
69 69
70 def getConfig(config, section, name, default=None): 70 def getConfig(config, section, name, default=None):
71 """Get a configuration option 71 """Get a configuration option