CGI: Run Script then load page
Tom Robinson
tom at alkali.spamfree.org
Sun Aug 5 14:51:49 EDT 2001
On Sun, 5 Aug 2001 12:34:55 +0200, gerhard.nospam at bigfoot.de (Gerhard
Häring) 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
>print "Location: http://www.rfceditor.org/" # New location
>print "" # Newline ends HTTP header
Coming from a perl background I was surprised there isn't a header
building function in the cgi module ... any reason behind this, or did
they just not think of it?
--
tom at alkali.spamfree.org
remove 'spamfree.' to respond
More information about the Python-list
mailing list