On 02/02/2006, at 5:54 PM, Nicolas Lehuen wrote:
Having read your work on Vampire (and its
module importing mechanism) I'm pretty sure it won't be long.
The new importer is actually a complete rewrite and some things
are done quite differently to what was done in Vampire. I have in
effect rewritten most of what is currently in the mod_python.apache
module, which is why you kept seeing me posting all manner of
wierd problems in JIRA of late. You may be happy to know though
that only a one line change is required in your current incarnation
of mod_python.publisher. Namely:
module = page_cache[req]
gets changed to:
module = apache.import_module(req.filename)
That may even tell you something about what I will be proposing.
And yes it is backwards compatible.
I can see where you're going. Is it a module cache separate from
sys.modules like I wrote in mod_python.publisher.
Yes.
but with a backwards
compatible interface through apache.import_module ?
Yes. First argument can be a full pathname, which supports the way that
mod_python.publisher works, or it can be a module name as before, in
which
case a search is made in appropriate directories relevant to context
of the
request being handled. If still can't be found, will pass it off
completely to bog
standard Python import which will search sys.path.
Plus module
dependencies management like in Vampire ?
Yes.
And much more which will hopefully make it easier to use and avoid
PythonPath/sys.path pollution, avoid having to have fixed absolute paths
in Apache configuration files and avoid problems with mixing in of
"import"
statement.
I really want to do some documentation before unleashing it though,
with all the reasoning behind why things are done certain ways. To
get to that point though, I have first been wanting to log JIRA entries
for all the significant issues so reference can be made to them in
part as justification. Thus, I do have a plan, I just need the time. :-)
Graham