Hi Graham,

Apart from the fact that it is a third way to import modules, I don't see any problem with the new importing system, as it fixes a lot of bugs while not touching anything on the apache.import_module side. We have agreed, I think, that we should not make mod_python.publisher.get_page() public, so that we don't confuse people needlessly. In fact I've just commented it out of the source code.

The only problem that the new importing introduces, is that if you use apache.import_module to import a published module, you get another module instance than the one mod_python.publisher uses (because the publisher has his own module cache, distinct from sys.modules).

This means that you cannot properly share data from a published module if the module which needs the data uses apache.import_module. That's why I introduced mod_python.publisher.get_page(). But that was a bad idea, since it introduced a third way to import module, on top of the standard import keyword and the apache.import_module() function.

Then again, this is a pretty far corner case, which would be annoying only for threaded MPM for people who have the very bad idea to use published modules as repositories for shared application data (whereas such data should be stored in statically loaded modules for now, until apache.import_module works properly). For any other way to use mod_python, the new publisher system is perfectly usable AND solves a lot of annoying problems.

I totally agree that all this is sub-optimal and that we should have a major overhaul of the importing system, along the guidelines you gave in your excellent article. But for the 3.2 release, I really think we can get half way to a correct system by keeping the current apache.import_module and using the new mod_python.publisher importing system. Let's do the complete right thing for the 3.3 release.

In any case, reverting mod_python.publisher back to using apache.import_module is quite easy, so if you guys want me to do it, no problem, I'll do it.

Regards,
Nicolas

2005/8/10, Graham Dumpleton <[EMAIL PROTECTED]>:

On 06/08/2005, at 12:02 AM, Gregory (Grisha) Trubetskoy wrote:

>
> Just thought I'd ask if we're making any progress towards a 3.2
> tarball to test. No pressure, just curious :-)

What I would like to know is what is going to happen in respect of the
changes to the module importer for mod_python.publisher.

I accept that it may solve some of the module importer problems as they
apply to mod_python.publisher, but as I raised as an issue once before
it introduces yet another way of modules being imported. This means you
have the "import" statement, "apache.import_module()" and now
"mod_python.publisher.get_page()". This could cause a lot of confusion
and result in even more questions on the mailing list about import
problems with there being no simple answer.

The last time I raised this there was some support for deferring any
changes to module importing to the version after 3.2. This was in part
to avoid introducing a solution which would probably get discarded with
the next version if "apache.import_module()" were to be fixed properly.
Yes it meant persisting with the problems of "apache.import_module()"
for a while more, but at least the issues are known.

Anyway, the current mod_python.publisher code is still using this new
module importer.

Can some one say definitively what the plans are in this area.

Graham


Reply via email to