mirror of https://github.com/tLDP/python-tldp
sorted(), so dirs and docs are processed stably
use sorted() on the sourcedirs and the contents of each directory so that the directories are always handled in order and the documents are also handled in order adjust logging also to refer to "Source collection dir" rather than just "dir"
This commit is contained in:
parent
20ae6bd25c
commit
605b57a1ea
|
@ -23,11 +23,12 @@ class SourceCollection(collections.MutableMapping):
|
||||||
|
|
||||||
if not all(results):
|
if not all(results):
|
||||||
for result, sdir in zip(results, dirs):
|
for result, sdir in zip(results, dirs):
|
||||||
logger.critical("Directory does not exist: " + sdir)
|
logger.critical("Source collection dir must already exist: %s",
|
||||||
|
sdir)
|
||||||
raise IOError(errno.ENOENT, os.strerror(errno.ENOENT), sdir)
|
raise IOError(errno.ENOENT, os.strerror(errno.ENOENT), sdir)
|
||||||
|
|
||||||
for sdir in dirs:
|
for sdir in sorted(dirs):
|
||||||
for fname in os.listdir(sdir):
|
for fname in sorted(os.listdir(sdir)):
|
||||||
candidates = list()
|
candidates = list()
|
||||||
possible = os.path.join(sdir, fname)
|
possible = os.path.join(sdir, fname)
|
||||||
if os.path.isfile(possible):
|
if os.path.isfile(possible):
|
||||||
|
|
Loading…
Reference in New Issue