summaryrefslogtreecommitdiffstats
path: root/ipsilon/util/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipsilon/util/data.py')
-rwxr-xr-xipsilon/util/data.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py
index 2a55bb2..70e7d74 100755
--- a/ipsilon/util/data.py
+++ b/ipsilon/util/data.py
@@ -189,6 +189,25 @@ class Store(object):
if con:
con.close()
+ def wipe_plugin_config(self, facility, plugin):
+ # Try to backup old data first, just in case ?
+ try:
+ con = sqlite3.connect(self._admin_dbname)
+ cur = con.cursor()
+ cur.execute("CREATE TABLE IF NOT EXISTS " +
+ facility + " (name TEXT,option TEXT,value TEXT)")
+ cur.execute("DELETE FROM " + facility + " WHERE name=?",
+ (plugin,))
+ con.commit()
+ except sqlite3.Error, e:
+ if con:
+ con.rollback()
+ cherrypy.log.error("Failed to wipe %s config: [%s]" % (plugin, e))
+ raise
+ finally:
+ if con:
+ con.close()
+
def get_data(self, plugin, idval=None, name=None, value=None):
con = None
rows = []
@@ -276,3 +295,21 @@ class Store(object):
finally:
if con:
con.close()
+
+ def wipe_data(self, plugin):
+ # Try to backup old data first, just in case
+ try:
+ con = sqlite3.connect(self._admin_dbname)
+ cur = con.cursor()
+ cur.execute("DROP TABLE IF EXISTS " + plugin + "_data")
+ cur.execute("CREATE TABLE " + plugin + "_data"
+ "(id INTEGER, name TEXT, value TEXT)")
+ con.commit()
+ except sqlite3.Error, e:
+ if con:
+ con.rollback()
+ cherrypy.log.error("Failed to wipe %s data: [%s]" % (plugin, e))
+ raise
+ finally:
+ if con:
+ con.close()