On 10/09/2006, at 12:28 PM, Sébastien Arnaud wrote:
I love the wiki you put together, lots of great stuff in there! I
am going to go back to the drawing board here due to all the new
things you presented available in mod_python 3.3 which I did not
know about. It looks like a fixuphandler would fit the bill for
what I am attempting to do. Once I get something working, I will
make sure to give more detailed info and a clear example of how the
framework/url matching works so that you can better advise on which
mod_python 3.3 features can be better taken advantage of.
In regards to mod_python.publisher, it looks like indeed it is
better to divorce myself from it after the points you brought up.
On that topic though, should I reuse at all the ModuleCache object
to load & cache modules? Or is there something more efficient/
better in mod_python 3.3?
Ignore the ModuleCache class which appears to be used by
mod_python.publisher
as when the new importer gets used in mod_python 3.3 it doesn't
actually get used.
In mod_python 3.3, I would suggest you simply assume/require that the
new module
importer is used and use apache.import_module() instead. The new
module importer
is the default in 3.3, but it still patches itself in in place of the
old module importers
and so just reading the code everything still looks to use the old.
The most important things you will want to know about
apache.import_module() in
mod_python 3.3 are:
1. The first argument 'module' can actually now also be an absolute
path to a module
code file, including '.py' extension. By specifying the actual
location, you skip any
searching through directories trying to find an appropriate match.
2. You don't need to ever supply 'log' or 'autoreload' arguments as
the function is now
able to always get them directly from Apache configuration
information appropriate to
the request.
3. Because of (1), when using handler directives in Apache
configuration, you can
now supply an absolute path for a handler module file as well. Where
module file is
in non standard location, this avoids need to setup PythonPath. The
need to set up
PythonPath explicitly should be much reduced and using it couldn't
indicate a wrong
setup and you might even find mod_python complaining about it.
You can check out some of the behaviour of the new module importer by
reading
the old mailing list thread at:
http://www.modpython.org/pipermail/mod_python/2006-April/020936.html
http://www.modpython.org/pipermail/mod_python/2006-May/021097.html
http://www.mail-archive.com/python-dev@httpd.apache.org/msg02185.html
There are lots of details though and not sure that these capture it
all. I still need to
turn this all into a wiki page as well and use some of it for
official mod_python docs. :-)
Graham