fix: allow for caps in file name suffixes #206

@schinkelg ran aground of this one and I took the opportunity to add a
test to catch this sort of thing for next time.
This commit is contained in:
Daniel Quinn
2017-03-28 21:01:50 +00:00
parent 5b88ebf0e7
commit fa4924d5ba
5 changed files with 102 additions and 3 deletions

View File

@@ -102,7 +102,7 @@ class Consumer(object):
parser_class = self._get_parser_class(doc)
if not parser_class:
self.log(
"info", "No parsers could be found for {}".format(doc))
"error", "No parsers could be found for {}".format(doc))
self._ignore.append(doc)
continue
@@ -160,6 +160,16 @@ class Consumer(object):
if result:
options.append(result)
self.log(
"info",
"Parsers available: {}".format(
", ".join([str(o["parser"].__name__) for o in options])
)
)
if not options:
return None
# Return the parser with the highest weight.
return sorted(
options, key=lambda _: _["weight"], reverse=True)[0]["parser"]