X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=html_generator.py;h=de7291c2518076e0e8e17b02cfd3e6cfe5652fae;hb=95d1e0c60e2f514fd67f8f619c15e9820a873cb4;hp=c16f033552cb80094befa995b04645fa1d612ba6;hpb=d443dffc599f0f858068bd22dcf289fcbe4d64f3;p=turbot-web diff --git a/html_generator.py b/html_generator.py index c16f033..de7291c 100644 --- a/html_generator.py +++ b/html_generator.py @@ -16,11 +16,21 @@ Requires sorttable.js, which should be included """ import boto3 from boto3.dynamodb.conditions import Key +import os import re +WEBROOT = "/srv/halibut.cworth.org/www" + website = "https://halibut.cworth.org/" #change this if we're using AWS or some other subdomain instead +def hunt_file(hunt, name): + """Return a path file 'name' within the given hunt. + + This will be withing WEBROOT and in a hunt-specific path.""" + + return "{}/{}/{}".format(WEBROOT, hunt['channel_id'], name) + def filename_from_name(name): """Returns a string derived from name, but with all spaces and slashes replaced with underscores, (for making a clean filename)""" @@ -91,7 +101,7 @@ def hunt_info(table, hunt_id): rounds = list(rounds) rounds.sort() - return puzzles, rounds + return hunt, puzzles, rounds def round_stat(rnd, puzzles): #Counts puzzles, solved, list of puzzles for a given round @@ -123,7 +133,7 @@ def round_stat(rnd, puzzles): -def overview(puzzles, rounds): +def overview(hunt, puzzles, rounds): #big board, main page. saves as index.html start = ['\n', '\n', @@ -131,7 +141,7 @@ def overview(puzzles, rounds): ' \n', ' \n', '\n', - ' \n', + ' \n', ' \n', '\n', '