form processing question

W

WmGill

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?

Thanks

Bill
 
J

John J. Lee

WmGill said:
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
[...question snipped...]

Which web framework / library are you using?

Or are you just using the standard library cgi module (most Python web
programmers use something more than that)?


John
 
W

WmGill

Like I said, I'm experimenting. I was thinking of using the standard cgi
module. but I'm open to suggestions.

Bill

John J. Lee said:
WmGill said:
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
[...question snipped...]

Which web framework / library are you using?

Or are you just using the standard library cgi module (most Python web
programmers use something more than that)?


John
 
I

Ian Bicking

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)
 
W

WmGill

You probably will be happier if you use something other than CGI,...
I thought the cgi interface was the standard for HTML form processing?
I believe os.environ()['SCRIPT_NAME'] should give you what you want...
I don't see where knowing the script name helps?

Others have also suggested using other programs. I obviously need to be
more clear in what I thought was a simple question.

Lets say I have a simple html form that asks for: First Name, Last Name,
department, Employee ID, and comments. An emplyee fills out the form,and
clicks submit. My script looks up the employee ID and doesn't find him/her,
so it returns (displays) the form for correction, but leaving all the
submitted information in the original input fields so that the employee
doesn't have to re-enter everything. I know how to do this in PHP, but want
to try it in Python.

Bill



Ian Bicking said:
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top