X-Git-Url: https://harishankar.org/repos/?p=biaweb_qt.git;a=blobdiff_plain;f=biaweb_db.py;fp=biaweb_db.py;h=9caad085f52a1f6ee4b6594020dd671c7aefb197;hp=4487339ae16bf3ca0ba570d46f6ee12b2db3770f;hb=e14aab0777f4dcc7200894ee75fab329007adb53;hpb=8c9cfa39545fd48c66d4e795a6d2d7faa396c6c9 diff --git a/biaweb_db.py b/biaweb_db.py index 4487339..9caad08 100644 --- a/biaweb_db.py +++ b/biaweb_db.py @@ -31,6 +31,19 @@ def update_category (dbname, catid, cat_name, cat_desc, cat_stub): except sqlite3.Error: return False +# function to remove a category +def remove_category (dbname, catid): + try: + conn = sqlite3.connect (dbname) + c = conn.cursor () + c.execute ("DELETE FROM categories WHERE cid=?;", (catid,)) + c.execute ("DELETE FROM articles WHERE cid=?;", (catid,)) + conn.commit () + conn.close () + return True + except sqlite3.Error: + return False + # function to set the configuration and update the database def set_configuration (dbname, site_title, site_url, keywords, description, copyright, num_rss, dest_path):