#! /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 def escape(data): data = data.replace('\\', '\\\\') data = data.replace('"', '\\"') data = data.replace('"', '\\"') return data #------------------------ CODE ------------------------------------ def main(): db = access.Access(dbname="pysocks", user='crypt') form = cgi.FieldStorage() desc = escape(form['description'].value) the_file = escape(form['the_file'].value) db.put('the_data', {'description':description, 'file':the_file}) print 'Content-type: text/html\n\nfile uploaded' #------------------------------------------------------------------------ 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 ------------------------------------