Associated files now included in puzzle.json

This commit is contained in:
slackish 2016-10-20 12:48:48 -06:00
parent cf922f3217
commit c85db04460
1 changed files with 2 additions and 9 deletions

View File

@ -97,9 +97,8 @@ if __name__ == '__main__':
# write out puzzles
for points in sorted(puzzles_dict):
puzzle = puzzles_dict[points]
puzzlebody = [json.dumps(puzzle.publish())]
puzzledir = os.path.join(categoryname, 'content', mapping[points])
# build/write json
puzzlejson = puzzle.publish()
# write associated files
assoc_files = []
@ -109,14 +108,8 @@ if __name__ == '__main__':
zf.writestr(os.path.join(puzzledir, fobj.name), \
fobj.handle.read())
if len(assoc_files) > 0:
puzzlebody.append("")
puzzlebody.append("## Associated Files:")
for f in assoc_files:
puzzlebody.append(f)
puzzlebody = os.linesep.join(puzzlebody)
puzzlejson["associated_files"] = assoc_files
# non-optimal writing of file-like objects, but it works
zf.writestr(os.path.join(puzzledir, 'puzzle.json'), \