models/watcher.py
def watch_module(self, name):
        "Load a module, determine which files it uses, and watch them"

        if imp.is_builtin(name) != 0:
            # Pretty pointless to watch built-in modules
            return

        (fd, pathname, description) = imp.find_module(name)

        try:
            mod = imp.load_module(name, fd, pathname, description)
            if fd:
                self._watch_file(fd.name, name)
            else:
                for root, dirs, files in os.walk(pathname):
                    for filename in files:
                        fpath = os.path.join(root, filename)
                        if fpath.endswith('.py'):
                            self._watch_file(fpath, name)
        finally:
            if fd:
                fd.close()
Load a module, determine which files it uses, and watch them
Load a module, determine which files it uses, and watch them
Load a module determine which files it uses and watch them
def watch_module(self, name):
        if imp.is_builtin(name) != 0:
            return
        (fd, pathname, description) = imp.find_module(name)
        try:
            mod = imp.load_module(name, fd, pathname, description)
            if fd:
                self._watch_file(fd.name, name)
            else:
                for root, dirs, files in os.walk(pathname):
                    for filename in files:
                        fpath = os.path.join(root, filename)
                        if fpath.endswith('.py'):
                            self._watch_file(fpath, name)
        finally:
            if fd:
                fd.close()
def watch_module ( self , name ) : if imp . is_builtin ( name ) != 0 : return ( fd , pathname , description ) = imp . find_module ( name ) try : mod = imp . load_module ( name , fd , pathname , description ) if fd : self . _watch_file ( fd . name , name ) else : for root , dirs , files in os . walk ( pathname ) : for filename in files : fpath = os . path . join ( root , filename ) if fpath . endswith ( '.py' ) : self . _watch_file ( fpath , name ) finally : if fd : fd . close ( )
Load a module, determine which files it uses, and watch them
Load a module determine which files it uses and watch them
"Load a module, determine which files it uses, and watch them" # Pretty pointless to watch built-in modules
self
name