[mod_python] Path related problems with PSP (possibly a bug)

d d at hell.art.pl
Wed Mar 1 15:47:01 EST 2006


Hello

  I've been having some weird path related problems using mod_python/ 
PSP, so I
decided to switch to using absolute paths everywhere, but that  
unfortunately didn't
help. Now I have little time to solve this, so I'd really appreciate  
a quick answer..
  Here's the problem:

# I have a /index.py with this contents:
def test (req):
   # test.html contains "foo <%= x %> "
   tmpl = psp.PSP (req, '/home2/kompassztuki/webapps/mod_python/ 
htdocs/test.html')
   tmpl.run (vars = { 'x' : 10 })

# And a /admin/index.py with:
def test (req):
   # test.html contains only "bar <%= x %> "
   tmpl = psp.PSP (req, '/home2/kompassztuki/webapps/mod_python/ 
htdocs/admin/test.html')
   tmpl.run (vars = { 'x' : 11 })

  To begin cleanly I restart the server and access /test. I get a  
page containing
"foo 10", as expected. Now I access /admin/test and the page says  
"bar 11", which
is still ok, but then, when I access /test again, I get the same page  
containing
"bar 11".
  Yes, I did flush the cache and reload the page. Mod_python seems to  
launch the
proper function, but in a wrong directory.
  Here's the Apache log for this whole event:

[Wed Mar 01 14:14:18 2006] [notice] caught SIGTERM, shutting down
[Wed Mar 01 14:14:21 2006] [notice] mod_python: Creating 32 session  
mutexes based on 256 max processes and 0 max threads.
[Wed Mar 01 14:14:21 2006] [notice] Apache/2.0.46 (Red Hat)  
mod_python/3.1.4 Python/2.4 configured -- resuming normal operations
[Wed Mar 01 14:14:33 2006] [notice] mod_python: (Re)importing module  
'mod_python.publisher'
[Wed Mar 01 14:14:33 2006] [notice] mod_python: (Re)importing module  
'test' with path set to '['/home2/kompassztuki/webapps/mod_python/ 
htdocs']'
[Wed Mar 01 14:14:33 2006] [notice] mod_python: (Re)importing module  
'index' with path set to '['/home2/kompassztuki/webapps/mod_python/ 
htdocs']'
[Wed Mar 01 14:14:34 2006] [notice] mod_python: (Re)importing module  
'favicon.ico' with path set to '['/home2/kompassztuki/webapps/ 
mod_python/htdocs']'
[Wed Mar 01 14:14:38 2006] [notice] mod_python: (Re)importing module  
'test' with path set to '['/home2/kompassztuki/webapps/mod_python/ 
htdocs/admin']'
[Wed Mar 01 14:14:38 2006] [notice] mod_python: (Re)importing module  
'index' with path set to '['/home2/kompassztuki/webapps/mod_python/ 
htdocs/admin']'
[Wed Mar 01 14:14:39 2006] [notice] mod_python: (Re)importing module  
'favicon.ico' with path set to '['/home2/kompassztuki/webapps/ 
mod_python/htdocs']'
[Wed Mar 01 14:14:43 2006] [notice] mod_python: (Re)importing module  
'test' with path set to '['/home2/kompassztuki/webapps/mod_python/ 
htdocs']'
[Wed Mar 01 14:14:43 2006] [notice] mod_python: (Re)importing module  
'favicon.ico' with path set to '['/home2/kompassztuki/webapps/ 
mod_python/htdocs']'
[Wed Mar 01 14:14:45 2006] [notice] mod_python: (Re)importing module  
'test' with path set to '['/home2/kompassztuki/webapps/mod_python/ 
htdocs']'
[Wed Mar 01 14:14:45 2006] [notice] mod_python: (Re)importing module  
'favicon.ico' with path set to '['/home2/kompassztuki/webapps/ 
mod_python/htdocs']'

  After some time of inactivity, or multiple refreshes, accessing / 
test will finally return
a page containing "foo 10", but accessing /admin/test will cause the  
same problem
once again. It seems the effect cannot be inversed, i.e. /admin/test  
always works fine.
  As I said before - a quick reply from anyone would be nice, I'm in  
trouble already ;]

thanks,
d


More information about the Mod_python mailing list