#! /usr/bin/python3
print ('Content-type: text/html\n')
Template='''
Interactive result
Version 2 (5/17/19) |
The person's name is: ???the_name???
Willing to subscribe? ???will_subscribe???
Optimistic? ???optimism???
Self-description: ???description???
Recommendation: ???the_rec???
|
'''
import cgi, cgitb
cgitb.enable()
def main():
form=cgi.FieldStorage()
the_name=form.getvalue('my_name','(nothing)')
HTML=Template
HTML=HTML.replace('???the_name???',the_name)
if form.getvalue('subscribe','')=='ON':
subscribe_answer='definitely'
else:
subscribe_answer='definitely not'
HTML=HTML.replace('???will_subscribe???',subscribe_answer)
optimism=form.getvalue('like_rad','')
HTML=HTML.replace('???optimism???',optimism)
description=form.getvalue('me','')
if description=='':
description='(nothing)'
elif type(description)==type([]):
description=' and '.join(description)
HTML=HTML.replace('???description???',description)
the_rec=form.getvalue('rec','')
HTML=HTML.replace('???the_rec???',the_rec)
print (HTML)
main()