You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by gr...@apache.org on 2006/12/04 22:25:03 UTC
svn commit: r482363 - /httpd/mod_python/trunk/Doc/modpython4.tex
Author: grahamd
Date: Mon Dec 4 13:25:02 2006
New Revision: 482363
URL: http://svn.apache.org/viewvc?view=rev&rev=482363
Log:
Updates to documentation for apache.import_module().
Modified:
httpd/mod_python/trunk/Doc/modpython4.tex
Modified: httpd/mod_python/trunk/Doc/modpython4.tex
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/Doc/modpython4.tex?view=diff&rev=482363&r1=482362&r2=482363
==============================================================================
--- httpd/mod_python/trunk/Doc/modpython4.tex (original)
+++ httpd/mod_python/trunk/Doc/modpython4.tex Mon Dec 4 13:25:02 2006
@@ -464,16 +464,27 @@
be candidates for reloading when found by the mod_python module importer.
In this scheme for maintaining a pseudo package, individual modules are
- still placed into a directory, but there cannot be a \code{__init__.py}
- file in the directory. If such a file does exist, it will simply be
- ignored. To import a module from this pseudo package, rather than using
- a '.' to distinguish a sub module from the parent, a '/' is used instead.
-
- For example:
+ still placed into a directory, but the \code{__init__.py} file in the
+ directory has no special meaning and will not be automatically imported
+ as is the case with true Python packages. Instead, any module within the
+ directory must always be explicitly identified when performing an import.
+
+ To import a named module contained within these pseudo package, rather
+ than using a '.' to distinguish a sub module from the parent, a '/' is
+ used instead. For example:
\begin{verbatim}
from mod_python import apache
module = apache.import_module('dirname/module_name')
+ \end{verbatim}
+
+ If an \code{__init__.py} file is present and it was necessary to import
+ it to achieve the same result as importing the root of a true Python
+ package, then \code{__init__} can be used as the module name. For example:
+
+ \begin{verbatim}
+ from mod_python import apache
+ module = apache.import_module('dirname/__init__')
\end{verbatim}
As a true Python package is not being used, if a module in the directory