def do_grep(self, path, match):
        """ grep's work horse """
        try:
            children = self.get_children(path)
        except (NoNodeError, NoAuthError):
            children = []

        for child in children:
            full_path = os.path.join(path, child)
            try:
                value, _ = self.get(full_path)
            except (NoNodeError, NoAuthError):
                value = ""

            if value is not None:
                matches = [line for line in value.split("\n") if match.search(line)]
                if len(matches) > 0:
                    yield (full_path, matches)

            for mpath, matches in self.do_grep(full_path, match):
                yield (mpath, matches)
def do_grep ( self , path , match ) : try : children = self . get_children ( path ) except ( NoNodeError , NoAuthError ) : children = [ ] for child in children : full_path = os . path . join ( path , child ) try : value , _ = self . get ( full_path ) except ( NoNodeError , NoAuthError ) : value = "" if value is not None : matches = [ line for line in value . split ( "\n" ) if match . search ( line ) ] if len ( matches ) > 0 : yield ( full_path , matches ) for mpath , matches in self . do_grep ( full_path , match ) : yield ( mpath , matches )
grep's work horse