[[email protected]: Re: [mod_python] [patch] make autoreload more useful]

Dustin Mitchell dustin at ywlcs.org
Wed May 29 20:24:02 EST 2002


On Thu, May 30, 2002 at 11:02:10AM +1000, Martin Pool wrote:
> 
> Anyhow, such a shop could always forbid use of the reloader.  There's
> no need to penalize all users for the sake of this rare and
> hypothetical case.

I guess I don't see the penalty.  I'm talking about adding a mechanism to
prevent *only certain modules* from being reloaded, e.g. add

..
__no_reload__ = 1  # don't reload this module, please
..

to your module and the reloader will leave it alone.

I think that there are a few -- admittedly border, obscure -- cases where
such a feature would be useful / convenient during development, and that the
implementation cost is nearly nothing.

To demonstrate unequivocally what I mean, here's a patch that can be applied
after the original patch at the root of this thread:

*** apache-orig Wed May 29 20:16:58 2002
--- apache.py   Wed May 29 20:18:08 2002
***************
*** 121,127 ****
                        APLOG_NOERRNO|APLOG_NOTICE)
      for module_name in sys.modules.keys():
          if not _orig_sys_modules.has_key(module_name):
!             del sys.modules[module_name]
  
  
  def _get_sub_module(top_module, module_name):
--- 121,128 ----
                        APLOG_NOERRNO|APLOG_NOTICE)
      for module_name in sys.modules.keys():
          if not _orig_sys_modules.has_key(module_name):
!             if not hasattr(sys.modules[module_name], '__no_reload__'):
!                 del sys.modules[module_name]
  
  
  def _get_sub_module(top_module, module_name):



More information about the Mod_python mailing list