summaryrefslogtreecommitdiffstats
path: root/Mac/Demo/cgi
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-09-09 01:47:24 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-09-09 01:47:24 (GMT)
commit5a1a17517021cfb9b43558efa13b602ce569fb1b (patch)
treebdb499785a285ed4de772bca07657176a88306a6 /Mac/Demo/cgi
parentf4c4f9e9e1663e93650c08f2ebafe0dfc49e0b52 (diff)
downloadcpython-5a1a17517021cfb9b43558efa13b602ce569fb1b.zip
cpython-5a1a17517021cfb9b43558efa13b602ce569fb1b.tar.gz
cpython-5a1a17517021cfb9b43558efa13b602ce569fb1b.tar.bz2
Example CGI applet
Diffstat (limited to 'Mac/Demo/cgi')
-rw-r--r--Mac/Demo/cgi/cgitest.cgi.py2
-rw-r--r--Mac/Demo/cgi/cgitest.cgi.rsrc.hqx122
-rw-r--r--Mac/Demo/cgi/realcgitest.py45
3 files changed, 169 insertions, 0 deletions
diff --git a/Mac/Demo/cgi/cgitest.cgi.py b/Mac/Demo/cgi/cgitest.cgi.py
new file mode 100644
index 0000000..ce59710
--- /dev/null
+++ b/Mac/Demo/cgi/cgitest.cgi.py
@@ -0,0 +1,2 @@
+# Debug applets quickly.
+execfile('realcgitest.py')
diff --git a/Mac/Demo/cgi/cgitest.cgi.rsrc.hqx b/Mac/Demo/cgi/cgitest.cgi.rsrc.hqx
new file mode 100644
index 0000000..967f9fe
--- /dev/null
+++ b/Mac/Demo/cgi/cgitest.cgi.rsrc.hqx
@@ -0,0 +1,122 @@
+(This file must be converted with BinHex 4.0)
+
+:%'0RDA4PFh3ZBfGT,R*cFQ-!FR0bBe*6483"!*!((`VqD`#3"!%!!!!G33!!(%%
+!!!(*0K3J9#"S!"3J8(d4X'J4!$S"CbB5,`a1ZJ)-$$S!@RN-BfGTG'9cG#jbFh*
+M,J)!!!"bFh*M8P0&4!%!!%!!D`!!FR0bBe*6483"!!"!!'X!N"+Z*Rm,!*!'(`V
+r%F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C)!J2rr!!!Er`#3"!%Xrrm!N!Q!rrm!!!&@!*!
+&JIrr!!!+13#3"B,rr`!!%a`!N!6rN!3!!!%%!*!&JIrr!!!+,J#3"B$rr`!!%a%
+!N!@$rrm!!"[d!*!%!5crr`!!!4)!N!@!rrm!!!KL!*!&JIrr!!!443#3"B,rr`!
+!'LJ!N!@!rrm!!!*D!*!&JIrr!!!,23#3"B,rr`!!&#!!N!@!rrm!!!4H!*!&JIr
+r!!!033#3"B,rr`!!&L3!N!@!rrm!!!LQ!*!&JIrr!!!4L3#3"B,rr`!!'Q`!N!@
+!rrm!!!NU!*!&JIrr!!!5$3#3"B,rr`!!'[!!N!SF,`#3"B(rr`!!($3!N!316hG
+ZCA)JFQ9cEh9bBfAj%`:
diff --git a/Mac/Demo/cgi/realcgitest.py b/Mac/Demo/cgi/realcgitest.py
new file mode 100644
index 0000000..ca846bf
--- /dev/null
+++ b/Mac/Demo/cgi/realcgitest.py
@@ -0,0 +1,45 @@
+"""cgitest - A minimal CGI applet. Echos parameters back to the client.
+"""
+
+from MiniAEFrame import AEServer, MiniApplication
+
+class CGITest(AEServer, MiniApplication):
+
+ def __init__(self):
+ MiniApplication.__init__(self)
+ AEServer.__init__(self)
+ self.installaehandler('aevt', 'oapp', self.open_app)
+ self.installaehandler('aevt', 'quit', self.quit)
+ self.installaehandler('WWW\275', 'sdoc', self.cgihandler)
+ self.mainloop()
+
+ def quit(self, **args):
+ self.quitting = 1
+
+ def open_app(self, **args):
+ pass
+
+ def cgihandler(self, pathargs, **args):
+ rv = """HTTP/1.0 200 OK
+Server: NetPresenz; python-cgi-script
+MIME-Version: 1.0
+Content-type: text/html
+
+<title>Python CGI-script results</title>
+<h1>Python CGI-script results</h1>
+<hr>
+"""
+ rv = rv+'<br><b>Direct object:</b> %s\n'%pathargs
+
+ for key in args.keys():
+ if key[0] != '_':
+ rv = rv + '<br><b>%s:</b> %s\n'%(key, args[key])
+ rv = rv +'<hr>\nSee you next time!\n'
+
+ # Note: if you want to quit after each request enable the line
+ # self.quitting = 1
+
+ return rv
+
+if __name__ == '__main__':
+ CGITest()