summaryrefslogtreecommitdiffstats
path: root/module/AccountManager.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-31 18:32:13 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-31 18:32:13 +0200
commit9ea1ab90b4705ef4d5ce37ded36a214f276c0a18 (patch)
tree995539a44a25c54344639d5ade7aa3e48624ed97 /module/AccountManager.py
parentadded account page (diff)
downloadpyload-9ea1ab90b4705ef4d5ce37ded36a214f276c0a18.tar.xz
add and delete accounts, db will be resetted
Diffstat (limited to 'module/AccountManager.py')
-rw-r--r--module/AccountManager.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/module/AccountManager.py b/module/AccountManager.py
index d90c957c3..6e2786d55 100644
--- a/module/AccountManager.py
+++ b/module/AccountManager.py
@@ -22,6 +22,7 @@ from random import choice
from module.common.json_layer import json
from module.utils import lock
+
class AccountManager:
"""manages all accounts"""
@@ -45,7 +46,6 @@ class AccountManager:
self.createAccount(plugin, loginname, password, options)
- return
def iterAccounts(self):
""" yields login, account for all accounts"""
@@ -55,11 +55,14 @@ class AccountManager:
def saveAccounts(self):
"""save all account information"""
+ # TODO: multi user
+ # TODO: activated
data = []
for name, plugin in self.accounts.iteritems():
- data.extend([(name, acc.loginname, acc.activated, acc.password, json.dumps(acc.options)) for acc in
- plugin.itervalues()])
+ data.extend(
+ [(name, acc.loginname, 1 if acc.activated else 0, acc.password, json.dumps(acc.options)) for acc in
+ plugin.itervalues()])
self.core.db.saveAccounts(data)
def createAccount(self, plugin, loginname, password, options):
@@ -102,7 +105,7 @@ class AccountManager:
self.core.db.removeAccount(plugin, user)
self.core.eventManager.dispatchEvent("account:deleted", plugin, user)
else:
- self.core.log.debug("Remove non existing account %s %s" % (plugin, user))
+ self.core.log.debug("Remove non existent account %s %s" % (plugin, user))
@lock