Skip to content

Commit

Permalink
Adding missing call to topdown=True in Generator.get_files
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C committed Oct 17, 2019
1 parent 643bccc commit e092f7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions pelican/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,15 @@ def get_files(self, paths, exclude=[], extensions=None):

if os.path.isdir(root):
for dirpath, dirs, temp_files in os.walk(
root, followlinks=True):
drop = []
root, topdown=True, followlinks=True):
excl = exclusions_by_dirpath.get(dirpath, ())
for d in dirs:
# We copy the `dirs` list as we will modify it in the loop:
for d in list(dirs):
if (d in excl or
any(fnmatch.fnmatch(d, ignore)
for ignore in ignores)):
drop.append(d)
for d in drop:
dirs.remove(d)
if d in dirs:
dirs.remove(d)

reldir = os.path.relpath(dirpath, self.path)
for f in temp_files:
Expand Down
2 changes: 1 addition & 1 deletion pelican/tests/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class LogCountHandler(BufferingHandler):
"""Capturing and counting logged messages."""

def __init__(self, capacity=1000):
logging.handlers.BufferingHandler.__init__(self, capacity)
super(LogCountHandler, self).__init__(capacity)

def count_logs(self, msg=None, level=None):
return len([
Expand Down

0 comments on commit e092f7c

Please sign in to comment.