From 6a86b735fb9723239f4d109e2a2985b7782807dc Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 12 Jun 2011 13:13:20 +0200 Subject: erniebs fixes, ul lifetime fix --- module/plugins/AccountManager.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'module/plugins/AccountManager.py') diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index e4c858a43..94af7cd82 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -20,12 +20,13 @@ from os.path import exists from shutil import copy +from threading import Lock + from module.PullEvents import AccountUpdateEvent -from module.utils import chmod +from module.utils import chmod, lock ACC_VERSION = 1 -######################################################################## class AccountManager(): """manages all accounts""" @@ -37,6 +38,7 @@ class AccountManager(): self.accounts = {} # key = ( plugin ) self.plugins = {} + self.lock = Lock() self.initAccountPlugins() @@ -138,7 +140,7 @@ class AccountManager(): for name in self.core.pluginManager.getAccountPlugins(): self.accounts[name] = {} - #---------------------------------------------------------------------- + @lock def updateAccount(self, plugin , user, password=None, options={}): """add or update account""" if self.accounts.has_key(plugin): @@ -149,7 +151,7 @@ class AccountManager(): self.saveAccounts() if updated: p.scheduleRefresh(user, force=False) - #---------------------------------------------------------------------- + @lock def removeAccount(self, plugin, user): """remove account""" @@ -159,7 +161,7 @@ class AccountManager(): self.saveAccounts() - + @lock def getAccountInfos(self, force=True, refresh=False): data = {} -- cgit v1.2.3