Issue Details (XML | Word | Printable)

Key: MODPYTHON-117
Type: Wish Wish
Status: Open Open
Priority: Major Major
Assignee: Graham Dumpleton
Reporter: Graham Dumpleton
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

PythonImport that works for any interpreter.

Created: 02/Feb/06 05:39 PM   Updated: 17/Mar/06 12:17 PM
Return to search
Component/s: core
Affects Version/s: 3.2.7
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide
Currently PythonImport requires that the name of the interpreter be explicitly named. If running lots of virtual hosts, where each is dynamically assigned their own interpreter name automatically, it is a lot of work to have to specify PythonImport directives for all virtual host interpreters where a particular module needs to be loaded in all interpreters.

Syntactically, it isn't hard to allow something like:

  PythonImport moduleforallinterpreters

or:

  PythonImport moduleforallinterpreters *

however the current location where such Python imports are done in mod_python will not allow this.

This is because such Python imports are done in the PythonChildInitHandler() function right after the child process is initialised. The code iterates through the list of imports and creates interpreters for the named interpreters and loads the modules. Where we want a module loaded into all modules, we will not actually know the names of all potential modules in advance at that point so can't do it.

The logical spot is to to load a module common to all modules in get_interpreter() when a request is first made for the interpreter. Thus, it may be possible to move the module imports from PythonChildInitHandler() into get_interpreter().

One issue that needs to be considered is that currently, having a PythonImport directive means that any named interpreter is always created at child initialisation, even if a request never arrives that is processed within the context of that interpreter. It might also be worthwhile adding syntax which allows one to specify whether a PythonImport should be performed at the point of child initialisation, or only when a request comes in that requires that specific interpreter. To keep backward compatability, the default would be at child initialisation time.

Not sure what would be a good syntax. The options would be 'child intialisation' and 'interpreter initialisation'. How to express that????


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.