[mod_python] question on new import functionality (python 3.3.0b)

Detmar Meurers dm at ling.ohio-state.edu
Tue Jan 9 18:31:32 EST 2007


I'm transitioning to mod_python 3.3.0b and have a question about the
description of import_module at
where it states

     As a new feature in mod_python 3.3, when using the standard
     Python ímport' statement to import a module, if the import is
     being done from a module which was previously imported by the
     mod_python module importer, it is equivalent to having called
     apache.import_module() directly.
     For example:

        import name

     is equivalent to:
        from mod_python import apache
            name = apache.import_module('name')

In a setup where I am using the mod_python.publisher to
load a file index.py as specified in an .htaccess file stating

DirectoryIndex index.html index.py
AddHandler python-program .py
PythonHandler mod_python.publisher

is that index.py being loaded using the new module importer?

Can I just use plain "import" in such an index.py file loaded by the
mod_python.publisher in order to import other modules using the new
importing mechanism - or do I have to explicitly use
"apache.import_module" in that index.py?


Detmar Meurers, Associate Professor, Dept. of Linguistics, OSU
201a Oxley Hall, 1712 Neil Avenue, Columbus OH 43210-1298, USA
http://ling.osu.edu/~dm/                 GnuPG key on web page

More information about the Mod_python mailing list