form processing question

Ian Bicking ianb at colorstudy.com
Sun Nov 2 19:13:25 EST 2003


On Nov 2, 2003, at 4:41 PM, WmGill wrote:
> I am experimenting with Python, and want to convert some of my PHP 
> scripts
> to python cgi scripts.  In PHP I use  PHP_SELF for the action target.  
> This
> way I can "reuse" data in fields (i.e. if the user enters data in a 
> field
> then submits the form,  it comes back already filled in on each 
> subsequent
> iteration).  I know I can do this in Python, but before I spend a lot 
> of
> time, is it very complicated, or can form field values be 
> (re-)populated
> easily?

You probably will be happier if you use something other than CGI, but 
for CGI I believe os.environ()['SCRIPT_NAME'] should give you what you 
want.  (This URL introspection differs considerably between frameworks)

--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org






More information about the Python-list mailing list