prefs.py
branchxbelweb
changeset 38 c30e2402deca
child 47 2781ac85b807
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prefs.py	Tue Oct 07 12:50:30 2003 -0400
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+import sys
+import traceback
+sys.path.insert(0, "/home/fabien/lib/python")
+sys.path.insert(0, "./lib")
+sys.stderr = sys.stdout
+
+print "Content-type: text/html; charset=iso-8859-1;"
+print
+
+# import cgitb; cgitb.enable()
+import cgi
+from htmltmpl import TemplateManager
+from webutils import get_template_processor
+import my_db
+import os
+
+def main(prefs):
+    tmpl = TemplateManager().prepare("prefs.tmpl")
+    tproc = get_template_processor(prefs)
+    fields = []
+    for field in ['keyword', 'count']:
+      fields.append({'field': field,
+                     'selected' : prefs['keywords_sort'] == field })
+    tproc.set('Sortfields', fields)
+    print tproc.process(tmpl)
+
+if (__name__ == "__main__"):
+    db = my_db.connect(os.environ["REMOTE_USER"])
+    main(db.get_preferences())