13 import cgi |
13 import cgi |
14 from htmltmpl import TemplateManager, TemplateProcessor |
14 from htmltmpl import TemplateManager, TemplateProcessor |
15 import my_db |
15 import my_db |
16 import time |
16 import time |
17 from bkmark import Bookmark |
17 from bkmark import Bookmark |
|
18 import os |
18 |
19 |
19 if (__name__ == "__main__"): |
20 def main(action, id, kwname, merge, mergename): |
20 form = cgi.FieldStorage() |
|
21 db = my_db.connect() |
|
22 id = int(form['id'].value) |
|
23 action = form['action'].value |
|
24 kwname = db.get_keyword(id) |
|
25 name = form['name'].value |
|
26 merge = int(form['keywords'].value) |
|
27 mergename = db.get_keyword(merge) |
|
28 tmpl = TemplateManager().prepare("kw_confirm.tmpl") |
21 tmpl = TemplateManager().prepare("kw_confirm.tmpl") |
29 tproc = TemplateProcessor() |
22 tproc = TemplateProcessor() |
|
23 tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Confirmation") |
30 tproc.set("confirm_delete", action == 'delete') |
24 tproc.set("confirm_delete", action == 'delete') |
31 tproc.set("confirm_merge", action == 'merge') |
25 tproc.set("confirm_merge", action == 'merge') |
32 tproc.set("confirm_update", action == 'update') |
26 tproc.set("confirm_update", action == 'update') |
33 tproc.set("action", action) |
27 tproc.set("action", action) |
34 tproc.set("id", id) |
28 tproc.set("id", id) |
36 tproc.set("newname", name) |
30 tproc.set("newname", name) |
37 tproc.set("mergeid", merge) |
31 tproc.set("mergeid", merge) |
38 tproc.set("mergename", mergename) |
32 tproc.set("mergename", mergename) |
39 print tproc.process(tmpl) |
33 print tproc.process(tmpl) |
40 |
34 |
|
35 if (__name__ == "__main__"): |
|
36 form = cgi.FieldStorage() |
|
37 db = my_db.connect(os.environ["REMOTE_USER"]) |
|
38 id = int(form['id'].value) |
|
39 action = form['action'].value |
|
40 kwname = db.get_keyword(id) |
|
41 name = form['name'].value |
|
42 merge = int(form['keywords'].value) |
|
43 mergename = db.get_keyword(merge) |
|
44 main(action, id, kwname, name, merge, mergename) |
|
45 |