PythonImport that works for any interpreter.
--------------------------------------------

         Key: MODPYTHON-117
         URL: http://issues.apache.org/jira/browse/MODPYTHON-117
     Project: mod_python
        Type: Wish
  Components: core  
    Versions: 3.2    
    Reporter: Graham Dumpleton


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????


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to