diff --git a/noinfo/walletscripts/make.py b/noinfo/walletscripts/make.py index bee825874..1524c75c5 100644 --- a/noinfo/walletscripts/make.py +++ b/noinfo/walletscripts/make.py @@ -1,10 +1,9 @@ #!/usr/bin/env python import os, operator, urllib, json, re - loser_dir = "/home/expo/loser" html_base = "<html><body>%(body)s</body></html>" -html_year_index = html_base % {"body": "<H1>%(year)s surveys</H1><H2>Persons</H2><UL>%(persons)s</UL><H2>Wallets</H2><table>%(wallets)s</table><H2>Needing Scanning</H2><ul>%(needing scanning)s</ul><H2>Website needing updating</H2><ul>%(website needing updating)s</ul>"} +html_year_index = html_base % {"body": "<H1>2015 surveys</H1><H2>Persons</H2><UL>%(persons)s</UL><H2>Wallets</H2><table>%(wallets)s</table><H2>Needing Scanning</H2><ul>%(needing scanning)s</ul><H2>Website needing updating</H2><ul>%(website needing updating)s</ul>"} html_year_person = "<li><a href='%(person)s.html'>%(person)s</a><ul>%(complaints)s</ul></li>" html_year_wallet_entry = "<tr><td><a href='%(walletindex)s'>%(walletname)s %(cave)s %(name)s</a></td> <td>%(complaints)s</td></tr>" html_person_wallet_entry = "<li><a href='%(walletindex)s'>%(walletname)s</a> <ul>%(complaints)s</ul></li>" @@ -44,23 +43,18 @@ wallets_needing_scanning = set() website_needing_updating = set() people = {} -#use dir this file is in to get current year -path,year = os.path.split(os.path.dirname(os.path.realpath(__file__))) - for item in os.listdir("."): if os.path.isdir(item): files = [] for f in os.listdir(os.path.join(".", item)): - if f not in ["contents.json", "contents.json~","index.html"] and os.path.isfile(os.path.join(".", item, f)): + if f not in ["contents.json", "index.html"] and os.path.isfile(os.path.join(".", item, f)): files.append(f) contents_path = os.path.join(".", item, "contents.json") - print "Reading file %s" % (contents_path) if not os.path.isfile(contents_path): json_file = open(contents_path, "w") json.dump(blank_json, json_file, indent = 1) json_file.close() json_file = open(contents_path) - #print json_file data = json.load(json_file) json_file.close() write_required = False @@ -97,7 +91,7 @@ for item in os.listdir("."): if not data["survex not required"] and data["survex file"] == "": survex_complaint = "A survex file is required, but has not been specified!" if not data["survex not required"] and not os.path.isfile(os.path.join(loser_dir, data["survex file"])): - survex_complaint = "The specified survex file (%s) does not exist here!" % data["survex file"] + survex_complaint = "The specified survex file does not exist here!" complaints = [] person_complaints = [] if survex_required: @@ -198,7 +192,7 @@ for person, person_wallets in people.items(): person_summary = dict(person_summary) year_index_file = open("index.html", "w") -year_index_file.write(html_year_index % {"year": year, "persons": reduce(operator.add, [html_year_person % {"person": person, +year_index_file.write(html_year_index % {"persons": reduce(operator.add, [html_year_person % {"person": person, "complaints": reduce(operator.add, [html_complaint_items % {"complaint": complaint, "count": count}