[mod_python] mod_php vs mod_py - include vs. import

Brian Hawthorne brianh at exelixis.com
Mon Jan 5 11:31:56 EST 2004


be careful though; there are some hidden gotchas lurking in this solution.
for example, if you reload a module defining some base class, but don't
reload all modules defining subclasses of that base, then the base class
object will no longer be the same as the corresponding base class object
in the __bases__ list for subclasses, and isinstance(sub, base) will fail
(leading to other failures, like the new builtin 'super' won't work
properly).

i did a lot of head scratching before i figured this out; but if all
you're reloading are static configuration modules exporting simple things
like constant immutable string or numeric variables, you should be ok.

cheers,
brian


On Mon, 5 Jan 2004, Kevin Ballard wrote:

> There's an easy solution:
>
> Keep a table of the modification dates of the relevant modules. In your
> handler function, compare the modification dates you stored with the
> current ones, and if any differ call reload() on that module.
>
> If you want an example, ask me and I can make one. But it shouldn't be
> too hard to do on your own.
>
> HTH,
> Kevin
>
> On Jan 5, 2004, at 3:46 AM, fowlertrainer at anonym.hu wrote:
>
> > I want to control my website with only one py file: the main.py.
> > But I got experience with one ugly thing in mod_python.
> >
> > In mod_php, the main.php file is can include many files, and all of
> > them can include many other files.
> > When I modify some or one of these files, the website is refreshed.
> >
> > But in mod_python, I cannot use the include, I have only one way to
> > share/split my sources: the import.
> > It is ok, but when I modify some of these imported files, the website
> > is not refreshed !!!
> >
> > My solution in this time to I use only one file.
> > It is not too good, because it is growing too much, and I cannot
> > separate it to units.
> >
> > Have any solution to this problem ????
>
> --
> Kevin Ballard
> kevin at sb.org
> http://www.tildesoft.com
> http://kevin.sb.org
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>



More information about the Mod_python mailing list