[Pythonmac-SIG] MacPython, CGI and free cd's

Jack Jansen jack@oratrix.nl
Thu, 03 Aug 2000 16:00:14 +0200


> At 12:30 PM +0200 03-08-2000, Jack Jansen wrote:
> >Will something simple like dropping the applet in the server's CGI directory
> >work?
> 
> With PythonCGISlave? No. It does if you run your script through
> BuildCGIApplet, which will create a .cgi applet ready to roll.
> Unfortunately for every change you will have to create the applet again.

Okay, this I'd like to change. This behaviour is nice once you have the cgi 
script working, but for debugging it's much easier if the PythonCGISlave 
engine would simply execfile() the script in a fixed folder.


> >Putting the
> >try/except in the wrapper, for instance (the user can always override it with
> >another try/exceept in their script).
> 
> I don't see why we should create different default behavior than for unix.

Okay, let's try a different angle: do you _oppose_ this behaviour or is it 
just that you don't think it worth it? (i.e. would you mind if I implemented 
it:-)

> >Also, on unix you can test your CGI script with something like
> >% QUERY_STRING=arg+arg+arg cgi-bin/myscript
> >but on the mac this isn't possible, but we could easily provide some help.
> 
> Ah, but that's an entirely different problem I'd say. How about a *very*
> simple wrapper, as an applet called, say, TestCGIScript:
> 
> import sys, os
> import EasyDialogs
> 
> if len(sys.argv) <> 2:
> 	print "please drop exactly one cgi script on this applet"
> 	sys.exit(1)
> 
> query = EasyDialogs.AskString("Enter query string:")
> if query:
> 	script = sys.argv[1]
> 	namespace = {"__name__": "__main__"}
> 	os.environ["QUERY_STRING"] = query
> 	execfile(script, namespace)

Exactly. 

> >Hmm, maybe this should be folded into the IDE? If you could "Run as CGI" from
> >the IDE and then "Save as CGI" (which would save in the right place, copy the
> >applet, etc) we would be giving people a pretty decent CGI development
> >environment...
> 
> And make the UI even messier than it already is? ;-)

Ok. We can always put some extensions in the IDE extension folder to give 
access to this.

I'm getting so enthusiastic about the project by now that I may well try and 
find some time to do the last little bits myself, as 99% of the code is 
already there (and I'd probably have to do the organization myself anyway, as 
that's mostly a question of beating on the installer).

What do you think, is CGI scripting important enough to put PythonCGISlave in 
the toplevel folder, along with a CGI folder? Also, would you be opposed to 
renaming it to CGIPython.cgi?
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm