[mod_python] mod_python.publisher weirdness

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed Apr 14 10:40:43 EST 2004



I think this is becoming a FAQ....

You cannot have modules with the same name in one Python interpreter.
Since both of the below directories execute within the same
subinterpreter, if you use same names for modules (index.py) as well as
any global variables, you will have name clashes and rather unpredictable
behaviour.

The solution is to either name things differently, or configure Apache
such that mrt and mrtJDB run in different subinterpreters.

I recommend reading this part of the manual:

http://www.modpython.org/live/current/doc-html/pyapi-interps.html

Grisha


On Tue, 13 Apr 2004, Jeff Hinrichs 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.
>
> Now things get really silly, if I continue to click on the href that points
> to http://mysite/mrt/ I sometimes get the http://mysite/mrtJDB/ page and now
> by clicking on the link repeatedly I haphazardly jump back and forth between
> the two pages.  It's as if mod_python.publisher is getting confused.
>
> This same occurence will also play out if the directories are arranged as:
> http://mysite/mrt/
> http://mysite/mrt/mrtJDB/
> and making the necessary changes to the apache conf
> httpd.conf:
> <Directory "/usr/local/www/data/mrt">
>     SetHandler mod_python
>     PythonHandler mod_python.publisher
>     PythonDebug On
> </Directory>
> <Directory "/usr/local/www/data/mrt/mrtJDB">
>     SetHandler mod_python
>     PythonHandler mod_python.publisher
>     PythonDebug On
> </Directory>
>  and restarting apache.
>
> I've tried from Moz 1.7, FireFox 0.8, and IE6
> I've dumped caches and turned on forced reloads
> I've put pragma no-cache and page expirations in the meta tags
> I've tried req.headers_out.add("Cache-Control:","no-cache")
> and req.headers_out.add("Pragma:","no-cache")
>
> I'm at a loss and googled myself silly.
>
> I must be doing something very wrong but I'm just not seeing it right now.
>
> help.
>
> Thanks,
>
> Jeff Hinrichs
>
> p.s. "mysite" is just a place holder for the actual webserver name.
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list