diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-07 23:03:29 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-07 23:03:29 +0100 |
commit | 624fd1d349f409c4a57beead710e4263c3984c4a (patch) | |
tree | 5943248c9066b081712ec026798d78f32456b865 | |
parent | ... just forgot something (diff) | |
download | pyload-624fd1d349f409c4a57beead710e4263c3984c4a.tar.xz |
account cache fix
-rw-r--r-- | module/AccountManager.py | 18 | ||||
-rw-r--r-- | module/web/pyload/views.py | 2 | ||||
-rwxr-xr-x | pyLoadCore.py | 5 |
3 files changed, 8 insertions, 17 deletions
diff --git a/module/AccountManager.py b/module/AccountManager.py index a76a9915a..4151f529c 100644 --- a/module/AccountManager.py +++ b/module/AccountManager.py @@ -36,7 +36,6 @@ class AccountManager(): self.accounts = {} # key = ( plugin ) self.plugins = {} - self.accountInfoCache = {} self.initAccountPlugins() @@ -155,21 +154,17 @@ class AccountManager(): p = self.getAccountPlugin(plugin) p.removeAccount(user) - if self.accounts.has_key(p): - if self.accounts[p].has_key(user): - del self.accounts[p][user] - self.saveAccounts() p.getAllAccounts(force=True) self.core.scheduler.addJob(0, self.core.accountManager.getAccountInfos) - - def getCachedAccountInfos(self, refresh=True): + + + def getAccountInfos(self, force=True, refresh=False): + data = {} + if refresh: self.core.scheduler.addJob(0, self.core.accountManager.getAccountInfos) - return self.accountInfoCache - - def getAccountInfos(self, force=True): - data = {} + force = False for p in self.accounts.keys(): if self.accounts[p]: @@ -177,7 +172,6 @@ class AccountManager(): data[p.__name__] = p.getAllAccounts(force) else: data[p] = [] - self.accountInfoCache = data e = AccountUpdateEvent() self.core.pullManager.addEvent(e) return data diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index ec690db1a..240465285 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -342,7 +342,7 @@ def config(request): else: messages.append(_("All options were set correctly.")) - accs = deepcopy(settings.PYLOAD.get_accounts()) + accs = deepcopy(settings.PYLOAD.get_accounts(False, False)) for accounts in accs.itervalues(): for data in accounts: if data["trafficleft"] == -1: diff --git a/pyLoadCore.py b/pyLoadCore.py index 7818e7312..c08b29f60 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -753,10 +753,7 @@ class ServerMethods(): return self.core.pullManager.getEvents(uuid) def get_accounts(self, force=False, refresh=True): - if force: - return self.core.accountManager.getAccountInfos() - else: - return self.core.accountManager.getCachedAccountInfos(refresh) + return self.core.accountManager.getAccountInfos(force, refresh) def update_account(self, plugin, account, password=None, options={}): """ create and update account """ |