#!/usr/bin/python import libxml2 import libxslt import os import sys import inspect from mod_python import apache try: import istic import character except: def index(): print "Problem importing istic data" exit; def index(): try: import libxslt except: return "Couldn't import libxslt module \n(%s)" % sys.path return "Yay Workyness" def test(req): returnOutput = "%s" % req.uri return returnOutput def error(): def error404(): return "File not found" return "That didn't work." def mysqltest(): try: import MySQLdb except: return "Couldn't import MYSQL module \n(%s)" % sys.path # connect try: db = MySQLdb.connect(host="localhost", user="user", passwd="pass", db="rpg") except MySQLdb.OperationalError: return "Couldn't connect to database (%s)" % sys.exc_info()[1][1] except: return "Unexpected error:", sys.exc_info()[0] # create a cursor cursor = db.cursor() # execute SQL statement cursor.execute("SELECT * FROM game") # get the resultset as a tuple result = cursor.fetchall() varReturn = "Morning" # iterate through resultset for record in result: pass varReturn = varReturn + ("%s --> %s\n" % (record[0], record[1])) return varReturn