do_edit_kw.py
author fabien
Sun, 28 Sep 2003 11:39:55 -0400
branchxbelweb
changeset 29 b5d3cc46b16d
parent 26 17b0cd274530
child 30 dbf4027d82fc
permissions -rwxr-xr-x
[svn r1563] Update to debian-changelog format.

#!/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
import os

def main(action, id, kwname, name, merge, mergename):
    tmpl = TemplateManager().prepare("kw_confirm.tmpl")
    tproc = TemplateProcessor()
    tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Confirmation")
    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)

if (__name__ == "__main__"):
    form = cgi.FieldStorage()
    db = my_db.connect(os.environ["REMOTE_USER"])
    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)
    main(action, id, kwname, name, merge, mergename)