03-17-06 07:47 AM
[ http://issues.apache.org/jira/brows...ON-118?page=all ]
Graham Dumpleton resolved MODPYTHON-118:
----------------------------------------
Fix Version: 3.3
Resolution: Fixed
> Allow PythonImport to optionally call function in module.
> ---------------------------------------------------------
>
> Key: MODPYTHON-118
> URL: http://issues.apache.org/jira/browse/MODPYTHON-118
> Project: mod_python
> Type: Wish
> Components: core
> Versions: 3.3
> Reporter: Graham Dumpleton
> Assignee: Graham Dumpleton
> Fix For: 3.3
>
> PythonImport can currently be used to specify that a module be imported into a nam
ed interpreter at the time that an Apache child process is initiated. Because all it
does is import the module, if any specific action needs to be triggered, it has to
be
done as a side effect of the module import.
> Triggering actions as a side effect of a module import is generally not a good id
ea as failure of the side effect action will cause the import of the module itself t
o fail if the code doesn't properly handle this situation. It is generally preferabl
e t
o import the module and when that has suceeded only then call a specific function contained
in the module to initiate the action.
> Thus proposed that PythonImport be able to take an optional function to be
called upon successful import of the name module. The syntax would be like
that for Python*Handler directives.
> PythonImport mymodule::myfunc myinterpreter
> This would have the effect of loading module "mymodule" in the interpreter
called "myinterpreter" and then calling "mymodule.myfunc()". No arguments w
ould be supplied to the function when called.
> Another benefit of this feature would be that it would allow a single modu
le to be able to contain a number of special initialisation functions that m
ight be triggerable. The user could selectively call those that might be req
uired.
> PythonImport mymodule::enable_caching myinterpreter
> PythonImport mymodule::disable_logging myinterpreter
> At the moment to do that, a distinct module would need to be created for e
ach where the only thing in the module is the call of the function.
> Note that in using something similar to mod_python option/config values, am talkin
g here about options that must be able to only be enabled/disable in one spot. The p
roblem with mod_python option/config values in Apache is that different parts of the
do
cument tree can set them to different values, which for some things is actua
lly a problem, such as the case with PythonAutoReload.
[ Post a follow-up to this message ]
|