author | fabien |
Tue, 07 Oct 2003 12:53:05 -0400 | |
branch | xbelweb |
changeset 39 | d0d089958f7d |
parent 38 | c30e2402deca |
child 41 | 7b7cd0e74ee3 |
permissions | -rwxr-xr-x |
0 | 1 |
#!/usr/bin/python |
2 |
||
3 |
import sys |
|
4 |
import traceback |
|
15 | 5 |
if (__name__ == '__main__'): |
6 |
sys.path.insert(0, "/home/fabien/lib/python") |
|
7 |
sys.path.insert(0, "./lib") |
|
8 |
sys.stderr = sys.stdout |
|
0 | 9 |
|
15 | 10 |
print "Content-type: text/html; charset=iso-8859-1;" |
11 |
||
0 | 12 |
|
13 |
# import cgitb; cgitb.enable() |
|
14 |
import cgi |
|
15 |
import my_db |
|
32 | 16 |
from webutils import * |
0 | 17 |
|
18 |
if (__name__ == "__main__"): |
|
19 |
form = cgi.FieldStorage() |
|
21
345ee7421989
[svn r1555] Add multiuser support and more templating.
fabien
parents:
17
diff
changeset
|
20 |
db = my_db.connect(environ["REMOTE_USER"]) |
32 | 21 |
selection = get_keywords(form, 'sel') |
22 |
exclusion = get_keywords(form, 'exc') |
|
23 |
if len(selection) == 0: |
|
24 |
keywords = set_selection(db, [], selection, exclusion) |
|
25 |
exc = map(lambda e: int(e['id']), keywords[1:]) |
|
3 | 26 |
bookmarks = db.select_bookmarks([0], exc) |
27 |
else: |
|
32 | 28 |
bookmarks = db.select_bookmarks(selection, exclusion) |
29 |
keywords = set_selection(db, |
|
30 |
map(lambda e: e[0], bookmarks), |
|
31 |
selection, exclusion) |
|
32 |
total = len(bookmarks) |
|
6
da757ef67c69
[svn r1540] Correction for zero-lenght results in bookmark search.
fabien
parents:
4
diff
changeset
|
33 |
if len(bookmarks) > 0: |
da757ef67c69
[svn r1540] Correction for zero-lenght results in bookmark search.
fabien
parents:
4
diff
changeset
|
34 |
bookmarks = db.get_bookmarks(map(lambda x: x[0], bookmarks)) |
3 | 35 |
bookmarks = map(lambda bk: bk.dict(), bookmarks) |
38
c30e2402deca
[svn r1582] Add some user preferences support (kw sorting and kw select box size).
fabien
parents:
32
diff
changeset
|
36 |
process_index(bookmarks, keywords, db.get_preferences()) |