index.py
branchxbelweb
changeset 47 2781ac85b807
parent 41 7b7cd0e74ee3
child 57 31271426f879
--- a/index.py	Fri Oct 24 14:19:30 2003 -0400
+++ b/index.py	Fri Oct 24 17:04:29 2003 -0400
@@ -13,24 +13,11 @@
 # import cgitb; cgitb.enable()
 import cgi
 import my_db
-from webutils import *
+from os import environ
+from webutils import load_index
 
 if (__name__ == "__main__"):
     form = cgi.FieldStorage()
     db = my_db.connect(environ["REMOTE_USER"])
-    selection = get_keywords(form, 'sel')
-    exclusion = get_keywords(form, 'exc')
-    if len(selection) == 0:
-    	keywords = set_selection(db, [], selection, exclusion)
-    	exc = map(lambda e: int(e['id']), keywords[1:])
-   	bookmarks = db.select_bookmarks([0], exc)
-    else:
-    	bookmarks = db.select_bookmarks(selection, exclusion)
-   	keywords = set_selection(db,
-		map(lambda e: e[0], bookmarks),
-		selection, exclusion)
-    total = len(bookmarks)
-    if len(bookmarks) > 0:
-    	bookmarks = db.get_bookmarks(map(lambda x: x[0], bookmarks))
-    bookmarks = map(lambda bk: bk.dict(), bookmarks)
-    process_index(bookmarks, keywords[1:], db.get_preferences())
+    prefs = db.get_preferences()
+    load_index(db, prefs, form)