Golawala, Moiz M (GE Infrastructure)
Moiz.Golawala at ge.com
Wed Oct 27 13:05:55 EDT 2004
Hi All, I guess, I didn't really describe what my problem was so I will include some code snippets to explain what I am confused about. In my httpd.conf file: <Directory /var/www/html/> PythonHandler main PythonDebug on </Directory> in my main.py file: from cheetah.Template import Template from mod_python import apache def handler(req): t = Template(file,"/var/www/html/main.tmpl") textlen = len(str(t)) req.set_content(t) req.set_content_length(textlen) apache.OK in my main.tmpl file: <html> <head></head> <body> <form action="valid.py"> <input type="text" size="20" name="input1"> <input type="text" size="20" name="input2"> <input type="submit" name="submit" value="submit"> </form </body> </html> My problem is that the browser renders the page that is defined in the main.tmpl file. But once I enter the text and click submit. I want the browser to display the page that is defined the template used in valid.py (as the form tag shows) but some how I get the main.py page back. The reason this is happening is that once I click the submit button, I get back to the server and the handler is invoked and main.py is called. I can never go to another page. I am sure I am doing something wrong. Please can someone help me out.. Or direct me to some place that show an example of how this mechanism works correctly. Again, any help is appreciated. Thanks Moiz Golawala -----Original Message----- From: mod_python-bounces at modpython.org [mailto:mod_python-bounces at modpython.org]On Behalf Of Golawala, Moiz M (GE Infrastructure) Sent: Wednesday, October 27, 2004 10:07 AM To: mod_python at modpython.org Subject: [mod_python] newbie question Hi All, I am very new to mod_python (I have developed application with python but am new to web development in general). I have read most of the documentation and I have a couple of questions. I am planning to use mod_python along with Cheetah to build an internal website for my company. So far I have include some basic handlers in apache and can view a hello world script on my browser. Now when I try to do something a little more complicated I am lost. I have a couple of text fields that I want the user to fill out and then hit the submit button. I can get that html page up but I don't understand the mechanism where once a user hits the submit button, how does he/she get to the next page on the site. In the documentation I don't see any multi page working examples. Can some one point me to some resource that has working mult-page html (PSP or Cheetah based) examples with the necessary Directory tags in the httpd.conf file so I can better understand what is going on. Any help is appreciated greatly. Thank you, Moiz _______________________________________________ Mod_python mailing list Mod_python at modpython.org http://mailman.modpython.org/mailman/listinfo/mod_python
|