[mod_python] Understanding mod_python

Papanii Okai papanii.okai at gmail.com
Thu Oct 19 15:30:41 EDT 2006


Hi Guys,
             As a newbie i have a couple of questions i would like to 
ask the group. Hopefully a good Samaritan will help me clear my confusion.
Question1:
Say i have the following form..

<html>
   <body>
            <span id=form>
                <form action="welcome.py/hello" method="post">
                    <span id="text">
                       Please enter your name:
                        <input type="text"/ name="name">
                        <input type=button>
                     </span>
                  </form>
            </span>
   </body>
</html>


now say i have the following Mod_Python handler..

from mod_python import apache
import Storage

def hello (ref, name):
   mydata = Storage()
   try:
       success = mydata.checkName(name)
   except:
       success = -9
   if success == 1:
       //edit span text to... "Welcome to my house" "name"
   else:
       edit span (id=text) to .."Sorry you are not welcome..."

   return apache.OK   Ok, so what i am trying to understand is how to 
use mod_python to update an existing page without recreating the page. 
(note: without using PSP). This probably will lead into my second 
question but is it possible to use mod_python with Ajax. Specifically 
how would i link mod_python and JavaScript together. I am assuming that 
a javascript function would callback a mod_python module. Once the 
request has returned some data, JavaScript would update the page 
accordingly. To be honest i am not sure if this makes any sense but i 
thought i would ask anyway.
   Also if anyone knows of any resource thats talks about using 
mod_python to create dynamic web pages, kindly let me know....


Thanx
--Papanii



More information about the Mod_python mailing list