Permalink
Browse files

add setting.del_setting and fix settin.set_setting updates not working

  • Loading branch information...
artnez committed May 21, 2012
1 parent 7214752 commit 7fc1bc9ea8a7b3071e0a476c9019cce59893bf7e
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/faceoff/models/setting.py
@@ -16,7 +16,11 @@ def get_setting(db, name, default=None):
def set_setting(db, name, value=None):
setting = db.find('setting', name=name)
if setting is None:
- query = 'INSERT INTO setting (name, value) VALUES (?, ?)'
+ query = 'INSERT INTO setting (value, name) VALUES (?, ?)'
else:
query = 'UPDATE setting SET value=? WHERE name=?'
- db.execute(query, (name, value))
+ db.execute(query, (value, name))
+
+@use_db
+def del_setting(db, name):
+ db.execute('DELETE FROM setting WHERE name=?', (name,))

0 comments on commit 7fc1bc9

Please sign in to comment.