[mod_python] please explain what's this

Sanjeev Divekar sanjeevdivekar at gmail.com
Mon Jul 24 05:15:04 EDT 2006


hi,

I am new to mod_python using Apache 2.0.54, Python 2.4.2 and
mod_python 3.2.8 on Windows 2003 Server

Can anybody explain these line of code

index = myclass()
show = myclass().show_data

also i have a question
what is filters?

*******************************************************************************
index.py
*******************************************************************************
from mod_python import apache
from mod_python import psp
from mod_python import util

class myclass:
    def __init__(self):
        return None

    def __call__(self, req, para=''):
        tmpl = psp.PSP(req, filename='a.html')
        tmpl.run(vars={'para':para})
        return

    def show_data(self, req, para):
        msg = "Your first name is " + para[0]
        self(req, para=msg)
        return

index = myclass()
show = myclass().show_data
*******************************************************************************
*******************************************************************************
a.html
*******************************************************************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<h1><%=para%></h1>
<form method="post" action="show">
	<input type="text" name="para">
	<input type="text" name="para">
	<input type="submit">
</form>
</BODY>
</HTML>
*******************************************************************************


-- 
Sanjeev Divekar
Sanmisha Technologies
Mobile : +91 9820427416
Email  : sanjeev at sanmisha.com


More information about the Mod_python mailing list