9 print "Content-type: text/html; charset=iso-8859-1;" |
9 print "Content-type: text/html; charset=iso-8859-1;" |
10 print |
10 print |
11 |
11 |
12 # import cgitb; cgitb.enable() |
12 # import cgitb; cgitb.enable() |
13 import cgi |
13 import cgi |
14 from htmltmpl import TemplateManager |
14 from templates import Template |
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 from webutils import get_template_processor |
|
19 import os |
18 import os |
20 |
19 |
21 def main(keywords, bk, prefs): |
20 def main(keywords, bk, prefs): |
22 tmpl = TemplateManager().prepare("add_bk.tmpl") |
21 tmpl = Template("add_bk.tmpl", prefs) |
23 tproc = get_template_processor(prefs) |
22 tmpl.set('ctitle', bk.name) |
24 tproc.set('ctitle', bk.name) |
23 tmpl.set('curl', bk.url) |
25 tproc.set('curl', bk.url) |
24 tmpl.set('desc', bk.desc) |
26 tproc.set('desc', bk.desc) |
25 tmpl.set('bkid', bk.id) |
27 tproc.set('bkid', bk.id) |
26 tmpl.set('Keywords', keywords) |
28 tproc.set('Keywords', keywords) |
27 print tmpl.process() |
29 print tproc.process(tmpl) |
|
30 |
28 |
31 if (__name__ == "__main__"): |
29 if (__name__ == "__main__"): |
32 form = cgi.FieldStorage() |
30 form = cgi.FieldStorage() |
33 id = int(form["id"].value) |
31 id = int(form["id"].value) |
34 db = my_db.connect(os.environ["REMOTE_USER"]) |
32 db = my_db.connect(os.environ["REMOTE_USER"]) |