0
|
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 htmltmpl import TemplateManager, TemplateProcessor
|
|
15 |
import my_db
|
|
16 |
import time
|
|
17 |
import bkmark
|
|
18 |
|
|
19 |
def main(msg):
|
|
20 |
tmpl = TemplateManager().prepare("add.tmpl")
|
|
21 |
tproc = TemplateProcessor()
|
|
22 |
tproc.set("msg", msg)
|
|
23 |
|
|
24 |
# tproc.set("syntax", user.syntax)
|
|
25 |
# for syntax in Tester.syntax_name:
|
|
26 |
# tproc.set("syntax_" + syntax,
|
|
27 |
# (Tester.syntax_name[user.syntax] == syntax))
|
|
28 |
# tproc.set("id", user.id)
|
|
29 |
# tproc.set("gender", user.gender);
|
|
30 |
# tproc.set("age", user.age);
|
|
31 |
# exp = []
|
|
32 |
# for key in Tester.keys:
|
|
33 |
# exp.append({ 'name' : key,
|
|
34 |
# 'value' : user.experience[key] });
|
|
35 |
# tproc.set('Exp', exp);
|
|
36 |
print tproc.process(tmpl)
|
|
37 |
|
|
38 |
if (__name__ == "__main__"):
|
|
39 |
form = cgi.FieldStorage()
|
|
40 |
cnx = my_db.connect()
|
|
41 |
entry = bkmark.get_from_form(form)
|
|
42 |
qry = entry.add_to_db(cnx)
|
|
43 |
main(str(qry))
|