equal
deleted
inserted
replaced
1 #!/usr/bin/python |
|
2 |
|
3 import sys |
|
4 import traceback |
|
5 sys.path.insert(0, "/home/fabien/lib/python") |
|
6 sys.path.insert(0, "./lib") |
|
7 sys.stderr = sys.stdout |
|
8 |
|
9 print "Content-type: text/html; charset=iso-8859-1;" |
|
10 print |
|
11 |
|
12 # import cgitb; cgitb.enable() |
|
13 import cgi |
|
14 from templates import Template |
|
15 import my_db |
|
16 import time |
|
17 import os |
|
18 |
|
19 def main(keywords, prefs): |
|
20 tmpl = Template("edit_kw.tmpl", prefs) |
|
21 tmpl.set('Keywords', keywords) |
|
22 print tmpl.process() |
|
23 |
|
24 if (__name__ == "__main__"): |
|
25 form = cgi.FieldStorage() |
|
26 db = my_db.connect(os.environ["REMOTE_USER"]) |
|
27 kw = db.get_all_keywords()[1:] |
|
28 kw = map(lambda elem: { |
|
29 'id' : elem[0], |
|
30 'keyword' : elem[1] }, kw) |
|
31 kw.sort(lambda l,r: cmp(l['keyword'],r['keyword'])) |
|
32 main(kw, db.get_preferences()) |
|