FYI. Part 1 of some information about new module importer in 3.3.
First, the new module importer has now been made the default in the 3.3
trunk in subversion.
If you need to be able to still use the old importer with some
existing code
because it doesn't seem to work with the new importer without some
changes,
then you can use the 'mod_python.legacy.importer' PythonOption directive
to specify for which interpreters the old importer should be used
for. This
option must be set at global scope within main Apache configuration
file.
That is, it cannot be set inside of VirtualHost, Directory, Location
or Files
directives, or inside .htaccess files.
To specify that all interpreters should continue to use old importer,
the option
should be set as:
PythonOption mod_python.legacy.importer *
To specify only selected interpreters should continue to use the old
importer
use:
PythonOption mod_python.legacy.importer name1,name2
where 'name1', 'name2' etc are the names of the interpreters. If you
don't
know how the interpreter is being named, use 'req.interpreter' in a
request
handler to find out. You could also hardwire your code to run under a
specific interpreter using the PythonInterpreter directive. For example:
PythonInterpreter name1
As well as the new importer now being the default, some additional
abilities
to configure the new importer have been added, and one ability removed.
First new ability is that it is now possible to set a PythonOption
that acts
similar to PythonPath directive, but which only applies to modules
imported
using the new module importer. For example, if you have common modules
stored in '/some/path/modules', you can specify:
PythonOption mod_python.importer.path "['/some/path/modules']"
The value must be able to be eval'd with the result being a list.
A difference to the PythonPath directive is that you cannot extend an
existing
path inherited from an outer scope. Ie., you can't (and shouldn't)
try and add
additional directories to 'sys.path'. You always need to explicitly
list all the
directories to be searched.
As PythonOption can be set at any level within Apache configuration,
this
option can be set in Location, Files, Directory or VirtualHost
directives. It can
also be set in .htaccess files. For various reasons though, it is
highly recommended
that it only be set once within the context of a specific
interpreter, and that should
be at same level as where the handler directives are specified.
Because it is now possible to specify an arbitrary fallback search
path for
modules, the PythonOption 'mod_python.importer.search_handler_root' has
been removed as the same thing can be done with the new option by
explicitly
listing the directory for the handler root.
I have to go out now, so I will continue with parts 2 and 3 detailing
some more
information later.
Graham