- for uid, apikey in gsettings.get_accounts().items():
- self.add_account(uid, apikey)
- gsettings.remove_account(uid)
+ for key_id, ver_code in gsettings.get_accounts().items():
+ self.add_account(key_id, ver_code)
+ gsettings.remove_account(key_id)
+
+ def _detect_and_backup_old_cfg(self):
+ """ Searches the config file for the string 'apikey', which
+ would only be present in the old legacy config file. If it's
+ found, it backs up the file and we start over.
+ """
+ try:
+ temp = open(self.cfg_file, "r")
+ except IOError:
+ # if it's not here, forget about it - mission accomplished
+ return
+ config_contents = temp.read()
+ temp.close()
+ if config_contents.find('apikey') > 0:
+ # move the file then create a new one
+ os.rename(self.cfg_file, self.cfg_file + '.old')
+ else:
+ # we've got an updated cfg file
+ pass
+