CoCalc Shared Fileswww / cgi-bin / mfd / mfe_source_html.pyOpen in CoCalc with one click!
Author: William A. Stein
1
#!/usr/bin/python
2
3
# mfe_source_html.py
4
# (c) William Stein, 2003
5
# If the input is valid render the page.
6
7
import cgi, mfd, sys, mfe_source
8
9
print "Content-Type: text/html" # HTML is following
10
print # blank line, end of headers
11
12
def Get_Source():
13
form = cgi.FieldStorage()
14
if form.has_key("id"):
15
return mfd.Source(int(form["id"].value))
16
else:
17
print "Error - missing source id! Invalid URL."
18
sys.exit(0)
19
20
source = Get_Source()
21
mfe_source.Display_Page(source)
22
23