diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-30 19:48:27 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-30 19:48:27 +0100 |
commit | 07ae3e0b09441cec7a7df8ad5a4e961aab04e5eb (patch) | |
tree | aef4b5df69f23df85f469d7a9b6cb00038cb7347 /module/database | |
parent | show active addons (diff) | |
download | pyload-07ae3e0b09441cec7a7df8ad5a4e961aab04e5eb.tar.xz |
save and delete configs
Diffstat (limited to 'module/database')
-rw-r--r-- | module/database/ConfigDatabase.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/module/database/ConfigDatabase.py b/module/database/ConfigDatabase.py index 2e9fdd9a0..554e07132 100644 --- a/module/database/ConfigDatabase.py +++ b/module/database/ConfigDatabase.py @@ -7,18 +7,14 @@ class ConfigMethods(DatabaseMethods): @async def saveConfig(self, plugin, config, user=None): - if user is None: - self.c.execute('INSERT INTO settings(plugin, config) VALUES(?,?)', (plugin, config)) - else: - self.c.execute('INSERT INTO settings(plugin, config, user) VALUES(?,?,?)', (plugin, config, user)) + if user is None: user = -1 + self.c.execute('INSERT INTO settings(plugin, config, user) VALUES(?,?,?)', (plugin, config, user)) @queue def loadConfig(self, plugin, user=None): - if user is None: - self.c.execute('SELECT config FROM settings WHERE plugin=? AND user=-1', (plugin, )) - else: - self.c.execute('SELECT config FROM settings WHERE plugin=? AND user=?', (plugin, user)) + if user is None: user = -1 + self.c.execute('SELECT config FROM settings WHERE plugin=? AND user=?', (plugin, user)) r = self.c.fetchone() return r[0] if r else "" |