| author | fabien |
| Sat, 18 Oct 2003 00:56:42 -0400 | |
| branch | xbelweb |
| changeset 45 | c81d480c3224 |
| parent 43 | 4d194fce51e1 |
| child 47 | 2781ac85b807 |
| permissions | -rwxr-xr-x |
| 15 | 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 |
||
11 |
||
12 |
# import cgitb; cgitb.enable() |
|
13 |
import cgi |
|
| 43 | 14 |
from htmltmpl import TemplateManager |
15 |
from webutils import get_template_processor |
|
| 15 | 16 |
import my_db |
17 |
from bkmark import Bookmark |
|
| 30 | 18 |
from webutils import get_keywords |
|
21
345ee7421989
[svn r1555] Add multiuser support and more templating.
fabien
parents:
16
diff
changeset
|
19 |
import os |
| 15 | 20 |
|
| 43 | 21 |
def main(action, sel_keywords, keywords, prefs): |
| 15 | 22 |
tmpl = TemplateManager().prepare("kw_confirm.tmpl")
|
| 43 | 23 |
tproc = get_template_processor(prefs) |
|
21
345ee7421989
[svn r1555] Add multiuser support and more templating.
fabien
parents:
16
diff
changeset
|
24 |
tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Confirmation")
|
| 15 | 25 |
tproc.set("confirm_delete", action == 'delete')
|
26 |
tproc.set("confirm_merge", action == 'merge')
|
|
| 30 | 27 |
tproc.set("confirm_rename", action == 'rename')
|
| 15 | 28 |
tproc.set("action", action)
|
| 30 | 29 |
tproc.set("Selected", sel_keywords)
|
30 |
tproc.set("Keywords", keywords)
|
|
| 15 | 31 |
print tproc.process(tmpl) |
32 |
||
|
21
345ee7421989
[svn r1555] Add multiuser support and more templating.
fabien
parents:
16
diff
changeset
|
33 |
if (__name__ == "__main__"): |
|
345ee7421989
[svn r1555] Add multiuser support and more templating.
fabien
parents:
16
diff
changeset
|
34 |
form = cgi.FieldStorage() |
|
345ee7421989
[svn r1555] Add multiuser support and more templating.
fabien
parents:
16
diff
changeset
|
35 |
db = my_db.connect(os.environ["REMOTE_USER"]) |
| 30 | 36 |
ids = get_keywords(form, 'kw') |
37 |
keywords = map(lambda e: { 'id': e[0], 'keyword': e[1]},
|
|
38 |
db.get_all_keywords()) |
|
39 |
keywords.sort(lambda x, y: cmp(x['keyword'],y['keyword'])) |
|
40 |
sel_keywords = filter(lambda e: e['id'] in ids, keywords) |
|
|
21
345ee7421989
[svn r1555] Add multiuser support and more templating.
fabien
parents:
16
diff
changeset
|
41 |
action = form['action'].value |
| 43 | 42 |
main(action, sel_keywords, keywords, db.get_preferences()) |
|
21
345ee7421989
[svn r1555] Add multiuser support and more templating.
fabien
parents:
16
diff
changeset
|
43 |