def loadAccounts(self): """loads all accounts available from db""" for info, password, options in self.core.db.loadAccounts(): # put into options as used in other context options = json.loads(options) if options else {} try: self._createAccount(info, password, options) except: self.core.log.error(_("Could not load account %s") % info) self.core.print_exc()
def loadValues(self, user, section): if (user, section) not in self.values: conf = self.db.loadConfig(section, user) try: self.values[user, section] = json.loads(conf) if conf else {} except ValueError: # Something did go wrong when parsing self.values[user, section] = {} self.core.print_exc() return self.values[user, section]
def loadAccounts(self): """loads all accounts available""" self.accounts = {} for plugin, loginname, activated, password, options in self.core.db.loadAccounts(): # put into options as used in other context options = json.loads(options) if options else {} options["activated"] = activated self.createAccount(plugin, loginname, password, options)
def loadAccounts(self): """loads all accounts available""" self.accounts = {} for plugin, loginname, activated, password, options in self.core.db.loadAccounts( ): # put into options as used in other context options = json.loads(options) if options else {} options["activated"] = activated self.createAccount(plugin, loginname, password, options)
def iterSections(self, user=None): """ Yields: section, metadata, values """ values = self.db.loadConfigsForUser(user) # Every section needs to be json decoded for section, data in values.items(): try: values[section] = json.loads(data) if data else {} except ValueError: values[section] = {} self.core.print_exc() for name, config in self.config.iteritems(): yield name, config, values[name] if name in values else {}
def loads(*args, **kwargs): kwargs['object_hook'] = convert_obj return json.loads(*args, **kwargs)