On 06 December 2003, Graham Fawcett said:
> Attached is a utility module that lets you "wrap" a PTL module in a proxy
> that will reload itself automatically if the source file changes. Since
> reloading is only done on modules that you wrap explicitly, there should be
> a minimum of side-effects.
Hmm, cool. I think I like it.
> Example: From my main module, I want to reload the module 'buggy' whenever
> its source changes:
>
> # ---- main.ptl ----
>
> from rtemplate import Reloadable
>
> import buggy # load the module once
> buggy = Reloadable(buggy) # wrap it
>
> _q_exports = ['buggy', ... ]
>
> ...
Yep, I definitely like it. Simple, explicit, and most importantly,
non-magical. I would add a proviso to the docs that module reloading is
sometimes useful, but impossible to implement correctly for all cases.
Still, if this hack works 70% or 80% of the time, it's worth adding to
Quixote.
I would rename the module to quixote.reloadable. (A module that
provides one primary class should be named after that class.) (Although
arguably the class could be better named: Reloader? ReloadProxy?)
Graham, what execution mechanism have you used this with -- SCGI?
FastSCGI? mod_python? other? I'll give it a try with FastCGI and see
how it works.
Greg
--
Greg Ward http://www.gerg.ca/
No animals were harmed in transmitting this message.