CGI POST Method...

Daniel Yoo dyoo at hkn.eecs.berkeley.edu
Thu Jan 24 03:29:52 CET 2002


Sheila King <usenet at thinkspot.net> wrote:
: On Sat, 19 Jan 2002 22:15:01 -0800, Sheila King <usenet at thinkspot.net>
: wrote in comp.lang.python in article <a2cr56.3vvaf2t.1 at kserver.org>:

:> Is there a way I can send data to my form, with POST Method, so that I
:> don't have to create hidden input fields in my form?

: OK, never mind...I found the answer to my question (finally).

: From Programming Python, 2nd ed. by Mark Lutz, page 725:

: """In general, there are a variety of ways to pass or retain state
: information between CGI script executions:

: * Hardcoded URL parameters in dynamically generated hyperlinks and embedded
: in web pages (...)
: * Hidden form input fields that are attached to form data and embedded in
: web pages, but not displayed on web pages
: * HTTP "cookies" that are stored on the client machine and transferred
: between client and server in HTTP message headers
: * General server-side data stores that include databases, persistent object
: shelves, flat files, and so on."""

Hi Shelia,

What you're probably looking for is some way of maintaining an HTTP
"session".  Since HTTP is designed to be stateless, this is somethat
difficult.  But there are ways of faking it --- for example, Java
Servlet Pages keep a cache of HTTPSession objects in memory and use a
cookie to keep track of the client.  If you had something like
mod_python, you could probably do something similar.

I did a quick web search, and found:

    http://archaeopteryx.com/opensource/httpsession

I haven't tried it myself yet, but it might be useful for you.  Good
luck!



More information about the Python-list mailing list