Refs #8: added some error checking for templates without .inf files

This commit is contained in:
Rob McMullen 2018-03-09 11:00:09 -08:00
parent 6ea00e263e
commit 4185ca5617

View File

@ -305,10 +305,15 @@ def get_template_info():
try:
with open(name + ".inf", "r") as fh:
s = fh.read()
try:
j = json.loads(s)
except ValueError:
continue
description = j["description"]
except IOError:
description = ""
if not description:
continue
d = textwrap.wrap(description, 80 - 1 - 14 - 2 - 2)
lines.append(fmt % (os.path.basename(name), d[0]))
lines.extend([fmt % ("", line) for line in d[1:]])