Peter Sanchez
petersanchez at gmail.com
Wed May 10 00:59:09 EDT 2006
On May 9, 2006, at 7:46 PM, Graham Dumpleton wrote: > Peter Sanchez wrote .. >> Also, I have a question on the apache.import_module() function. >> Should >> this be done in *all* modules that are subsequently imported. IE >> >> index.py imports myconfig.py >> myconfig.py in turn imports sys, os and re >> >> Should myconfig.py be using apache.import_module() as well? >> >> Is there an option to do the equivilent of 'from module import *', >> etc? > > Standard Python modules should always be included with "import" and > NOT > with "apache.import_module()". When should apache.import_module() be used? I am using "import" for mod_python, standard python and custom modules. > > Also, a general rule is that you should not import the same module > using > both "import" and "apache.import_module()" from different places. > If you > break this rule, you can end up with modules being wrongly reloaded > which can cause problems. See: > > http://www.dscpl.com.au/articles/modpython-003.html#redundant- > module-loading > > You may want to read that whole article, as it describes various other > module importing issues when using mod_python. Thanks, I will read the entire article. Peter > > Graham
|