#!/usr/bin/env python2 import cgi # enable debugging: displays detailed exceptions in web browser. import cgitb; cgitb.enable() import MySQLdb # temporary: eventually put 'effrecipes.py' into a standard PYTHONPATH # location, like /usr/lib/python2.3/site-packages/ import sys sys.path.append('/home/sussman/projects/effrecipes/objects') import effrecipes # ----------------------------------------------------------------- # Initialize database connection conn = MySQLdb.connect(user='effuser', passwd='effuser', db='effrecipes') # Grab the object from the database form = cgi.FieldStorage() val = form["Id"].value # this better be a valid ID ingredient = effrecipes.ingredient_lookup(int(val), conn) # Initial generic HTML 'header' output print "Content-type: text/html\n\n"; print "Effrecipes -- Ingredient Display\n" print '

Ingredient: "' + ingredient.Name + '"

\n\n' print '(click the record to modify it)
' print "\n" print "" print '' print '' print "\n" print "
IngIDName
', ingredient.IngId, '', ingredient.Name, '

" # Cleanup and exit print "" conn.close()