do_edit_kw.py
branchxbelweb
changeset 43 4d194fce51e1
parent 30 dbf4027d82fc
child 47 2781ac85b807
equal deleted inserted replaced
42:6d31ed0f6ad3 43:4d194fce51e1
     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, TemplateProcessor
    14 from htmltmpl import TemplateManager
       
    15 from webutils import get_template_processor
    15 import my_db
    16 import my_db
    16 from bkmark import Bookmark
    17 from bkmark import Bookmark
    17 from webutils import get_keywords
    18 from webutils import get_keywords
    18 import os
    19 import os
    19 
    20 
    20 def main(action, sel_keywords, keywords):
    21 def main(action, sel_keywords, keywords, prefs):
    21     tmpl = TemplateManager().prepare("kw_confirm.tmpl")
    22     tmpl = TemplateManager().prepare("kw_confirm.tmpl")
    22     tproc = TemplateProcessor()
    23     tproc = get_template_processor(prefs)
    23     tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Confirmation")
    24     tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Confirmation")
    24     tproc.set("confirm_delete", action == 'delete')
    25     tproc.set("confirm_delete", action == 'delete')
    25     tproc.set("confirm_merge", action == 'merge')
    26     tproc.set("confirm_merge", action == 'merge')
    26     tproc.set("confirm_rename", action == 'rename')
    27     tproc.set("confirm_rename", action == 'rename')
    27     tproc.set("action", action)
    28     tproc.set("action", action)
    36     keywords = map(lambda e: { 'id': e[0], 'keyword': e[1]},
    37     keywords = map(lambda e: { 'id': e[0], 'keyword': e[1]},
    37    	 db.get_all_keywords())
    38    	 db.get_all_keywords())
    38     keywords.sort(lambda x, y: cmp(x['keyword'],y['keyword']))
    39     keywords.sort(lambda x, y: cmp(x['keyword'],y['keyword']))
    39     sel_keywords = filter(lambda e: e['id'] in ids, keywords)
    40     sel_keywords = filter(lambda e: e['id'] in ids, keywords)
    40     action = form['action'].value
    41     action = form['action'].value
    41     main(action, sel_keywords, keywords)
    42     main(action, sel_keywords, keywords, db.get_preferences())
    42 
    43