WebKit.ImportSpy
index
/usr/local/share/webware/WebKit/ImportSpy.py

ImportSpy
 
Keeps track of modules not imported directly by Webware for Python.
 
This module helps save the filepath of every module which is imported.
This is used by the `AutoReloadingAppServer` (see doc strings for more
information) to restart the server if any source files change.
 
Other than keeping track of the filepaths, the behaviour of this module
loader is identical to Python's default behaviour.
 
If the system supports FAM (file alteration monitor) and python-fam is
installed, then the need for reloading can be monitored very effectively
with the use of ImportSpy. Otherwise, ImportSpy will not have much benefit.
 
Note that ImportSpy is based on the new import hooks of Python 2.3 described in
PEP 302, falling back to the old ihooks module if the new hooks are not available.
In some cases this may become problematic, when other templating systems are
used with Webware which are also using ihook support to load their templates,
or if they are using zipimports. Therefore, it is possible to suppress the use
of ImportSpy by setting `UseImportSpy` in AppServer.config to False.

 
Classes
       
__builtin__.object
ImportSpy

 
class ImportSpy(__builtin__.object)
    New style import tracker.
 
  Methods defined here:
__init__(self, path=None)
Create importer.
find_module(self, fullname)
Replaces imp.find_module.
load_module(self, fullname)
Replaces imp.load_module.

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'ImportSpy' objects>
list of weak references to the object (if defined)

 
Functions
       
activate(imp_manager)
Activate ImportSpy.

 
Data
        path_hooks = [<type 'zipimport.zipimporter'>]
path_importer_cache = {'.': None, '/usr/local/lib/python2.4': None, '/usr/local/lib/python2.4/': None, '/usr/local/lib/python2.4/email': None, '/usr/local/lib/python2.4/encodings': None, '/usr/local/lib/python2.4/lib-dynload': None, '/usr/local/lib/python2.4/lib-tk': None, '/usr/local/lib/python2.4/plat-freebsd6': None, '/usr/local/lib/python2.4/site-packages': None, '/usr/local/lib/python2.4/site-packages/mx': None, ...}