diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-06 13:35:50 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-06 13:35:50 +0100 |
commit | 6aea4d06313f6dadfea9617aa4de6a1639785829 (patch) | |
tree | 77b7dc173e4760858979a3007a04fb5c21021c7b | |
parent | account fix (diff) | |
download | pyload-6aea4d06313f6dadfea9617aa4de6a1639785829.tar.xz |
account cache fix
-rw-r--r-- | module/AccountManager.py | 15 | ||||
-rw-r--r-- | module/plugins/Account.py | 3 |
2 files changed, 10 insertions, 8 deletions
diff --git a/module/AccountManager.py b/module/AccountManager.py index 70f694fcc..0409e5115 100644 --- a/module/AccountManager.py +++ b/module/AccountManager.py @@ -38,9 +38,7 @@ class AccountManager(): self.plugins = {} self.initAccountPlugins() - - self.accountInfoCache = {} - + self.loadAccounts() self.saveAccounts() # save to add categories to conf @@ -155,16 +153,19 @@ class AccountManager(): p = self.getAccountPlugin(plugin) p.removeAccount(user) + cache = self.accountInfoCache + if self.cache.has_key(p.__name__): + if cache[p].has_key(user): + del cache[p][user] + self.saveAccounts() p.getAllAccounts(force=True) def getAccountInfos(self, force=False, cache=False): data = {} - if not force: - return self.accountInfoCache - elif not cache: + if cache: self.core.scheduler.addJob(0, self.core.accountManager.cacheAccountInfos) #prevent gui from blocking - return self.accountInfoCache + force = False for p in self.accounts.keys(): if self.accounts[p]: diff --git a/module/plugins/Account.py b/module/plugins/Account.py index c630a47df..086665493 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -63,6 +63,7 @@ class Account(): self.accounts = accounts for user, data in self.accounts.iteritems(): self._login(user, data) + self.infos[user] = {} def updateAccounts(self, user, password=None, options={}): if self.accounts.has_key(user): @@ -85,7 +86,7 @@ class Account(): def getAccountInfo(self, name, force=False): """ return dict with infos, do not overwrite this method! """ data = Account.loadAccountInfo(self, name) - if not self.infos.has_key(name) or force: + if force: self.core.log.debug("Get %s Account Info for %s" % (self.__name__, name)) req = self.getAccountRequest(name) |