From 24c3447d6c3cdff80a35e159935c059d4db1714a Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Fri, 6 May 2011 21:04:29 +0200 Subject: [PATCH] make file-times directly use walk, also skip dot-dirs --- pelican/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pelican/utils.py b/pelican/utils.py index f9f17489..42a4fc0c 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -192,9 +192,10 @@ def files_changed(path, extensions): def file_times(path): """Return the last time files have been modified""" - for top_level in os.listdir(path): - for root, dirs, files in os.walk(top_level): - for file in filter(with_extension, files): + for root, dirs, files in os.walk(path): + dirs[:] = [x for x in dirs if x[0] != '.'] + for file in files: + if any(file.endswith(ext) for ext in extensions): yield os.stat(os.path.join(root, file)).st_mtime global LAST_MTIME