#! /usr/bin/python #------------------------------------------------------------------------ # name: # author: J Skinner # Date Written: # Purpose: # Notes #------------------------------------------------------------------------ #------------------------ GLOBALS ------------------------------------ DEBUG_MAIN = 0 DEBUG = 0 IS_CGI = 1 IS_DB = 1 #------------------------ IMPORTS ------------------------------------ import string import os import sys import cgi import traceback import access #import cookie from auth import Auth from page import Page #------------------------ GLOBALS ---------------------------------- HEADER_BLOCK = '''\ Content-type: text/html %(cookie)s ''' #------------------------ CODE ------------------------------------ def get_xtra_info(form): return None def main(): print 'Content-type: text/html' print db = access.Access(dbname='pysocks', user='crypt') page_info = None auth = Auth(db) form = cgi.FieldStorage() status, page_id = auth.login_check(form) xtra_info = get_xtra_info(form) if form.has_key('page'): if page_id == None: page_id =form['page'].value the_page = Page(page_id, db, auth, page_info, xtra_info) else: # render the default page the_page = Page(1, db, auth, page_info, xtra_info) # output the actual page print HEADER_BLOCK%{'cookie':auth.show()} print the_page.show() print '-- END OF PAGE --' #------------------------------------------------------------------------ if (DEBUG_MAIN): try: main() except SystemExit: pass except: # errMessage("an unkown error has occurred program terminating") sys.stderr = sys.stdout print '\n\n<PRE>' traceback.print_exc() else: main() #------------------------ END ------------------------------------