diff -r 6b31934e5b2e -r 31271426f879 lib/actions/edit.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/actions/edit.py Sat Dec 27 20:23:39 2008 -0500 @@ -0,0 +1,24 @@ +#!/usr/bin/python + +from templates import Template + +def main(keywords, bk, prefs): + tmpl = Template("add_bk.tmpl", prefs) + tmpl.set('ctitle', bk.name) + tmpl.set('curl', bk.url) + tmpl.set('desc', bk.desc) + tmpl.set('bkid', bk.id) + tmpl.set('Keywords', keywords) + print tmpl.process() + +def do_it(action, db, prefs, form): + id = int(form["id"].value) + bk = db.get_bookmarks([id])[0] + kw = db.get_all_keywords()[1:] + kw.sort(lambda l,r: cmp(l[1],r[1])) + (ids, kws) = apply(zip,db.get_keywords([id])) + kw = map(lambda elem: { + 'id' : elem[0], + 'keyword' : elem[1], + 'selected' : elem[0] in ids }, kw) + main(kw, bk, prefs)