allow case-insensitive matching for document types

The Python names for the document types are upper-cased and probably not
predictably named for the end user; allow a case-insensitive match when trying
to turn off building or listing for a particular document type.
This commit is contained in:
Martin A. Brown 2016-03-01 11:01:32 -08:00
parent aff926bb58
commit b54962900d
1 changed files with 8 additions and 4 deletions

View File

@ -115,11 +115,15 @@ def getStatusNames(args):
def getDocumentClasses(args):
sought = set()
largs = [x.lower() for x in args]
sought = list()
for cls in tldp.typeguesser.knowndoctypes:
if cls.__name__.lower() in args:
sought.add(cls)
remainder = set(args).difference(sought)
if cls.__name__.lower() in largs:
sought.append(cls)
else:
sought.append(None)
remainder = set([y for x, y in zip(sought, args) if x])
sought = set(sought)
return sought, remainder