equal
deleted
inserted
replaced
|
1 #!/usr/bin/python |
|
2 |
|
3 import sys |
|
4 import cgi |
|
5 import my_db |
|
6 from os import environ |
|
7 from actions import actions |
|
8 from config import CONFIG |
|
9 |
|
10 def main(): |
|
11 sys.stderr = sys.stdout |
|
12 print "Content-type: text/html; charset=iso-8859-1;" |
|
13 print |
|
14 form = cgi.FieldStorage() |
|
15 debug = form.has_key('debug') |
|
16 if debug: |
|
17 sys.stderr = sys.stdout |
|
18 print "<pre>" |
|
19 db = my_db.connect(CONFIG, environ["REMOTE_USER"]) |
|
20 prefs = db.get_preferences() |
|
21 if form.has_key('action'): |
|
22 action = form['action'].value |
|
23 else: |
|
24 action = 'default' |
|
25 if action in actions.keys(): |
|
26 actions[action](action, db, prefs, form) |
|
27 else: |
|
28 actions['default']('default', db, prefs, form) |
|
29 if debug: |
|
30 print "</pre>" |