[mod_python] import module via publisher

Gregory (Grisha) Trubetskoy grisha at modpython.org
Tue Jun 26 07:18:15 EST 2001


There is something in the FAQ about that as well:

http://www.modpython.org/FAQ/faqw.py?req=show&file=faq03.001.htp

On Tue, 26 Jun 2001 piet at cs.uu.nl wrote:

> >>>>> richard hitier <richard.hitier at idealx.com> (RH) wrote:
>
> RH> in fact, from now on I can tell two points:
> RH> (remember I work whith the publisher)
>
> RH> 1╨    calling http://my_page/module/fonction
>
> RH> always give me the latest modifications results (whithout restarting
> RH> apache at all)
>
> That is because mod_python has special code to check if the module has
> changed and should be reloaded.
>
> RH> 2╨     But if I call some imported code in my module.fonction()
> RH> this will never be updated according to imported module file last
> RH> modifications.
>
> That is because you do not use this special check yourself.
> You can do:
>
> module = apache.import_module(module_name)
> >>
>
> RH> * Le  19 Jun >Jonas Meyer Rasmussen< ecrivait:
> >>
> >> import my.module
> >>
> >> def handler( req ):
> >> reload( my.module )
> >>
> RH> I can't do that since that I'm porting code from zope app to apache app.
> RH> And, they import name instead of module:
>
> RH>     from foreign_module import my_name
>
> RH> and this (afaik) canot be reloaded in python.
>
> Yes, you can do it again after reloading the module:
>
> foreign_module = apache.import_module("foreign_module")
> from foreign_module import my_name
> --
> Piet van Oostrum <piet at cs.uu.nl>
> URL: http://www.cs.uu.nl/~piet [PGP]
> Private email: P.van.Oostrum at hccnet.nl
>
>
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list