[mod_python] mod_python.publisher weirdness

Kamil Niechajewicz kamil at nvstudio.pl
Wed Apr 14 13:31:50 EST 2004


On Tue, 13 Apr 2004 22:50:08 -0500
"Jeff Hinrichs" <jlh at cox.net> wrote:

> mod_python: 3.1.3
> OS: FreeBSD 4.9 Stable
> Apache: Apache/2.0.49 (Unix) mod_python/3.1.3 Python/2.3.3
> 
> httpd.conf:
> <Directory "/usr/local/www/data/mrt">
>     SetHandler mod_python
>     PythonHandler mod_python.publisher
>     PythonDebug On
> </Directory>
> <Directory "/usr/local/www/data/mrtJDB">
>     SetHandler mod_python
>     PythonHandler mod_python.publisher
>     PythonDebug On
> </Directory>
> 
> I have an index.py in each of the two directories.  On both pages a link to
>  http://mysite/mrt/  exists.
> 
> Events to recreate:
>  http://mysite/mrt/
>  click on a form to do a post to http://mysite/mrt/xlogon (a method in
> /mrt/index.py)
>  Edit the URL in the browser to http://mysite/mrtJDB/
>  When that page appears click on the link to http://mysite/mrt/
> 
> The page reloads and URL says, http://mysite/mrt/ the apache log agrees,
> and no errors reported in the error log. However, the page is still the
> http://mysite/mrtJDB/ page. If I click on the link 2 or 3 more times then
> I get the http://mysite/mrt/ page.

when you say "i get <xx> page" you mean that you get the content of this
page, instead of the expected one?

i think there is some serious problem with mod_python messing the file 
names of modules. i've ran into it recently and wrote about it here when
i was using my own handler - when there was two dirs with 90% of file
names being named the same mod_python was randomly picking files from
both directories, even if there was clearly stated "for this directory
use those files, for the other, those". 

and now i'm playing with publisher and here's what i've done:

/maindir 
    index.py   - frontend
/maindir/admin
       index.py            - backend
       someothermodule.py  - ..

now when i enter page at url '/' i get frontend, then i enter '/admin'
and i get backend, but when i return to '/' (with Back button or editing 
url in browser textbox) sometimes i get frontend and sometimes i get backend.
it seems that it somehow mistake files with the same name, but it should
not! :(

and btw. i often get this error, don't know why this happens, unreferenced
variable is very common error and should be handled somehow because there
is high possibility that it will occur somewhere:

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 481, in import_module
    if mtime > oldmtime:

UnboundLocalError: local variable 'oldmtime' referenced before assignment

best regards,
 Kamil


More information about the Mod_python mailing list