--- a/add.py Tue Sep 23 10:26:35 2003 -0400
+++ b/add.py Tue Sep 23 15:11:11 2003 -0400
@@ -14,30 +14,17 @@
from htmltmpl import TemplateManager, TemplateProcessor
import my_db
import time
-import bkmark
-
-def main(msg):
- tmpl = TemplateManager().prepare("add.tmpl")
- tproc = TemplateProcessor()
- tproc.set("msg", msg)
+from bkmark import Bookmark
-# tproc.set("syntax", user.syntax)
-# for syntax in Tester.syntax_name:
-# tproc.set("syntax_" + syntax,
-# (Tester.syntax_name[user.syntax] == syntax))
-# tproc.set("id", user.id)
-# tproc.set("gender", user.gender);
-# tproc.set("age", user.age);
-# exp = []
-# for key in Tester.keys:
-# exp.append({ 'name' : key,
-# 'value' : user.experience[key] });
-# tproc.set('Exp', exp);
+def main(keywords):
+ tmpl = TemplateManager().prepare("add_bk.tmpl")
+ tproc = TemplateProcessor()
+ tproc.set('Keywords', keywords);
print tproc.process(tmpl)
if (__name__ == "__main__"):
- form = cgi.FieldStorage()
- cnx = my_db.connect()
- entry = bkmark.get_from_form(form)
- qry = entry.add_to_db(cnx)
- main(str(qry))
+ db = my_db.connect()
+ kw = db.get_all_keywords()[1:]
+ kw.sort(lambda l,r: cmp(l[1],r[1]))
+ kw = map(lambda elem: { 'id' : elem[0], 'keyword' : elem[1] }, kw)
+ main(kw)