8 	sys.stderr = sys.stdout  | 
     8 	sys.stderr = sys.stdout  | 
     9   | 
     9   | 
    10 	print "Content-type: text/html; charset=iso-8859-1;"  | 
    10 	print "Content-type: text/html; charset=iso-8859-1;"  | 
    11 	print  | 
    11 	print  | 
    12   | 
    12   | 
    13 # import cgitb; cgitb.enable()  | 
    13 import cgitb; cgitb.enable()  | 
    14 import cgi  | 
    14 import cgi  | 
    15 import my_db  | 
    15 import my_db  | 
    16 from os import environ  | 
    16 from os import environ  | 
    17 from webutils import load_index  | 
    17 from actions import actions;  | 
    18   | 
    18   | 
    19 if (__name__ == "__main__"):  | 
    19 if (__name__ == "__main__"):  | 
    20     form = cgi.FieldStorage()  | 
    20     form = cgi.FieldStorage()  | 
         | 
    21     if form.has_key('debug'): | 
         | 
    22 	sys.stderr = sys.stdout  | 
         | 
    23 	print "<pre>"  | 
    21     db = my_db.connect(environ["REMOTE_USER"])  | 
    24     db = my_db.connect(environ["REMOTE_USER"])  | 
    22     prefs = db.get_preferences()  | 
    25     prefs = db.get_preferences()  | 
    23     load_index(db, prefs, form)  | 
    26     if form.has_key('action'): | 
         | 
    27     	action = form['action'].value  | 
         | 
    28     else:  | 
         | 
    29     	action = 'default'  | 
         | 
    30     if action in actions.keys():  | 
         | 
    31     	actions[action](action, db, prefs, form)  | 
         | 
    32     else:  | 
         | 
    33     	actions['default']('default', db, prefs, form) | 
         | 
    34     print "</pre>"  |