I worked it out. As my change didn't disable the mpservlets caching system, it was never triggering the module importer again to perform its own checks. Thus, if I add:
klass, cached_mtime, servlets = self.class_cache.get(fname, (None,None, [])) # XXX Pretend we didn't find it so mod_python importer used klass, cached_mtime, servlets = (None,None, []) # XXX if not klass or mtime > cached_mtime: In other words, a bit more work is required in mpservlets as with the new module importer as it shouldn't really be supplying its own caching system as that then defeats the mod_python importers own caching and reloading system. BTW, if you have program that can display DOT graphs, the graph data was produced using: PythonLogHandler ./_loghandler.py and the following as the log handler. from mod_python import apache def loghandler(req): try: output = file('/tmp/request.dot', 'w') output.write(apache.modules_graph(1)) finally: output.close() return apache.OK Seeing the relationships between your modules and the data presented there can be helpful sometimes in seeing what is happening and working out how the module importer works. Graham On 18/05/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
On 18/05/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > Just change this in your mpservlets package. The new importer can > handle arbitrary extensions so can load .mps files no problem. With > just this change your tutorial example works with no problems and it > uses 'import' to get stuff from handler directory. > > kundalini:/usr/local/src/mpservlets-1.1.6 grahamd$ diff > servlet.py.dist servlet.py > 1269,1270c1269,1271 > < code = {} > < execfile(fname, code) > --- > > #code = {} > > #execfile(fname, code) > > module = apache.import_module(fname) > 1276c1277,1278 > < klass = code[basename] > --- > > #klass = code[basename] > > klass = getattr(module, basename) Hmmm, although web pages are being displayed okay, there is something strange about the scenario in which apache.import_module() is being used which is meaning that depth searches for changes to child resulting in reloading from root down isn't working. Thus, if changing a module which isn't a root module, then I am still needing to restart Apache which I shouldn't have to with the new module importer. :-( For example, if I change _SitePage.py in attached graph, then the two .mps files and _SitePage.py should be reloaded on next request to either of the .mps files, but it isn't. Looks like I'll have to track down why as must be missing something very subtle, or obvious, which is causing the module importer not to behave as expected. Graham