CGI: Run Script then load page

Bengt Richter bokr at accessone.com
Sun Aug 5 22:03:39 CEST 2001


On Sun, 5 Aug 2001 12:34:55 +0200, gerhard.nospam at bigfoot.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) wrote:

>On 4 Aug 2001 21:41:11 -0700, Lang <bob at tharin.com> wrote:
>>Any cgi/web person out there,
>>
>>I wrote a couple cgi scripts that I use to manage a database.  When I
>>send changes through a form, it calls a script that makes the database
>>commit.  Once it is done with the commit, it prints out a return
>>button (that's all that shows up on the page) which needs to be pushed
>>to return to the main page.  How do I call the script, run the commit,
>>and then return to a given URL as one step instead of two?
>
>The solution Roman proposed works, but the following is technically better :-)
>It uses features of the HTTP protocol instead.
>
>#!/usr/bin/env python
>print "Status-Code: 301"                        # Moved permanently
I think he might want 302 instead (moved temporarily). He will likely want
to be able to come back and do the form again ;-)

>print "Location: http://www.rfceditor.org/"     # New location
>print ""                                        # Newline ends HTTP header
>
>>I think that this is pretty basic, but I can't find an answer. 
>
>This and more useful information can be found in RFC 2616 (HTTP 1.1).
>http://www.rfceditor.org feature a searchable RFC index, for example.




More information about the Python-list mailing list