#!c:/Python24/python.exe
"""
Read an input string and display it in a page which includes Logos
RefTagger magic. This is meant to run as a CGI script.
"""
HTML_TEMPLATE = \
"""
Logos RefTaggerizer
Logos RefTaggerizer
"""
userinput = ''
import sys
sys.stderr = sys.stdout
import os
import cgi
import cgitb; cgitb.enable()
def print_html_form(input):
"""
print the form to stdout, with action set to this very script
(a 'self-posting form': script both displays AND processes the
form).
"""
print "content-type: text/html; charset=iso-8859-1\n"
print HTML_TEMPLATE % {'SCRIPT_NAME': os.environ['SCRIPT_NAME'],
'INPUT': input}
def get_input(form_field):
form = cgi.FieldStorage()
if not form.has_key(form_field): return
return form[form_field].value
print_html_form(get_input('input_1'))