]> git.cworth.org Git - turbot-web/blobdiff - html_generator.py
Replace slashes in puzzle name to create a filename
[turbot-web] / html_generator.py
index 9eee85c95f1fcf62d9a47a4214c398743c3f6dc5..3ee751c989348e6c5004ec399fa6dc403f4972be 100644 (file)
@@ -14,7 +14,9 @@ that would be great
 
 Requires sorttable.js, which should be included
 """
+import boto3
 from boto3.dynamodb.conditions import Key
+import re
 
 website = "https://halibut.cworth.org/"
 #change this if we're using AWS or some other subdomain instead
@@ -325,7 +327,8 @@ def puzzle_overview(puzzle):
      '\n',
      '</body>\n',
      '</html>\n']
-    underscored = "_".join(name.split())
+    # Replace all spaces and slashes in the name with underscores
+    underscored = re.sub(r'[ /]', '_', name)
     file = "{}.html".format(underscored)
     f = open(file, "w")
     for line in html: