Graham Dumpleton wrote:
The whole point of the changes which were made was to draw a well
defined line between the code modules used in the web application and
which reside in the document tree, or other specially specified areas
by way of mod_python module importer path, and the standard Python
sys.path locations.
I think it's important to emphasize this point.
That there was no distinction before is what
caused all the issues with same named modules, loading of incorrect
modules, reloading of modules which shouldn't be reloaded etc etc.
And it's also important to point out that discussion of these problems
has become virtually nonexistent, whereas they used to dominate the list.
I remember when I first brought up this idea of 'import' working in
magic ways so things would just work as one expected, that there were
at least one person who thought it was a silly idea.
That could well have been me. I viewed the issues as limitations, not
necessarily weaknesses, and knew what to expect once I refined my
approach. I was worried that changing the module importer could
introduce more issues and force users to include proprietary mod_python
code in their modules (excluding handlers, which are a special case).
In the end I had
to give up on even trying to explain it because it would have taken me
months just to get people to understand what I had in mind. Instead, I
just wrote the code and I believe most would have to say the result in
certainly better than what was there before and that code now just
works as how one would expect it to work when one uses 'import'
whereas it didn't always before.
Since I keep nearly all of my code outside of the document tree, I'm not
necessarily the target beneficiary of the changes made to the module
importer. But it has eliminated namespace collisions and reloading
issues in my frontends, so I benefit from the improvements and agree
that things are much better. 3.3 is easily my favorite version of
mod_python.
All I can suggest is you try it by starting with the changes to
mpservlets as I described and then simply see if your existing
applications which use mpservlets still work. Since the release we
have only had a few people even be slightly affected by the
differences, plus all the complaints we used to get about problems
with the old importer have pretty well vanished.
I'm lucky enough that none of my applications are publicly distributed,
so I was able to normalize all of my sytems and patch the code where
needed. If you're patching production code, I recommend restarting
apache after your changes (in spite of the new reloading behaviour) and
tailing the apache error log for several hours.
Daniel's in a rough spot, though, because he has to support all of the
versions of mod_python that are out there (within reason). While we may
find it trivial, the average user is unlikely to upgrade from a version
included in the platform distribution (which could be dangerous if other
packages were tweaked to rely on the state of mod_python when it was
packaged). It sounds like he will still need to include his old caching
system and disable it when it's not needed. Hopefully, this won't be too
hard or require a fork.