FAQ
hi,

i am newbie to python so i am trying to learn mod_python as my new
development kit for my small web apps.

i am getting strange result can anybody explain me.
*********************************************************************************************
index.py
*********************************************************************************************
from mod_python import apache
from mod_python import psp
from mod_python import util

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

def show_data(req, name):
index(req, name)
*********************************************************************************************

*********************************************************************************************
a.htm
*********************************************************************************************

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
</HEAD>
<BODY>
<h1><%=para%></h1>
<form method="post" action="http://localhost:8080/test/show_data">
<input type="text" name="name">
<input type="submit">
</form>
</BODY>
</HTML>
*********************************************************************************************

*********************************************************************************************
Result
*********************************************************************************************
None
<textbox> <submitbutton>

Mod_python error: "PythonHandler mod_python.publisher"
Traceback (most recent call last):
File "E:\Python24\Lib\site-packages\mod_python\apache.py", line 299, in
HandlerDispatch result = object(req)
File "E:\Python24\Lib\site-packages\mod_python\publisher.py", line 213,
in handler published = publish_object(req, object)
File "E:\Python24\Lib\site-packages\mod_python\publisher.py", line 412,
in publish_object return Publish_object(req,util.apply_fs_data(object,
req.form, req=req))
File "E:\Python24\lib\site-packages\mod_python\util.py", line 439, in
apply_fs_data return object(**args)
File "E:\Apache Group\Apache2\htdocs\test\index.py", line 8, in index
tmpl.run()
File "E:\Python24\Lib\site-packages\mod_python\psp.py", line 213, in
run exec code in global_scope
File "E:\Apache Group\Apache2\htdocs\test\a.html", line 1, in ?
NameError: name 'para' is not defined
********************************************************************************************


what's wrong in this code?
any good internet resource to learn mod_python?

thanks in advanced
Sanjeev

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedJul 7, '06 at 5:56p
activeJul 7, '06 at 9:08p
posts2
users2
websitepython.org

People

Translate

site design / logo © 2022 Grokbase