[mod_python] apache.py suggestions

Greg Stein gstein at lyra.org
Fri May 26 09:12:23 EST 2000

On Fri, 26 May 2000, Gregory Trubetskoy wrote:
> On Fri, 26 May 2000, Greg Stein wrote:
> > > The reasoning behind using exec to import was that __import__ doesn't
> > > understand dots (packages),
> > 
> > Eh? Sure it does.
> Looks like it does indeed. I wonder why I put this comment in
> (now obsolete) httpdapy:
>                 # we could use __import__ but it can't handle packages
>                 exec "import " + module_name
> May be it's something new with 1.5 or 1.5.2? I'm almost tempted to compile
> an old Python version, but I think I'll pass.... :-)

Yes, it is new to the Python 1.5 series. Before then, packages were only
possible if "ni" was imported. 1.5 built the logic directly into the core.

Due to the Interpreter/Thread State stuff in mod_python.c, you are
specific to Python 1.5 anyways, so relying on __import__ and packages
should be fine.


Greg Stein, http://www.lyra.org/

More information about the Mod_python mailing list