[svn r1551] Add delete bookmarks functionality as well as many reusability issues.
#!/usr/bin/python
import sys
import traceback
sys.path.insert(0, "/home/fabien/lib/python")
sys.path.insert(0, "./lib")
sys.stderr = sys.stdout
print "Content-type: text/html; charset=iso-8859-1;"
print
# import cgitb; cgitb.enable()
import cgi
from htmltmpl import TemplateManager, TemplateProcessor
import my_db
import time
from bkmark import Bookmark
if (__name__ == "__main__"):
form = cgi.FieldStorage()
db = my_db.connect()
id = int(form['id'].value)
action = form['action'].value
kwname = db.get_keyword(id)
name = form['name'].value
merge = int(form['keywords'].value)
mergename = db.get_keyword(merge)
tmpl = TemplateManager().prepare("kw_confirm.tmpl")
tproc = TemplateProcessor()
tproc.set("confirm_delete", action == 'delete')
tproc.set("confirm_merge", action == 'merge')
tproc.set("confirm_update", action == 'update')
tproc.set("action", action)
tproc.set("id", id)
tproc.set("name", kwname)
tproc.set("newname", name)
tproc.set("mergeid", merge)
tproc.set("mergename", mergename)
print tproc.process(tmpl)