FAQ

sanjeevdivekar a ?crit :
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
Nothing strange here AFAICT.
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()
Here, you call tmpl.run() two time, the first time with a dict having an
entry named 'param', the second time without it.
a.htm
********************************************************************************************* (snip)
<BODY>
<h1><%=para%></h1>
And here you try to display something named "para". I don't have much
knowledge of PSP, but I have enough experience to assert this try to get
the entry named "param" from the dict passed to tmpl.run().

(snip)
Result (snip)
File "E:\Apache Group\Apache2\htdocs\test\index.py", line 8, in index
tmpl.run()
Here we are : line 8 of index.py, your second call to tmpl.run() without
the dict.
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
and here the tentative to get this name from the dict.

Doesn't seem so strange to me. Note that I could be wrong - you'd better
check in PSP documentation - but I think I'd try commenting out the
second (and AFAICT useless) call to tmpl.run().

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 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