diff --git a/html_templates.py b/html_templates.py index 964b6175..22575824 100644 --- a/html_templates.py +++ b/html_templates.py @@ -1,10 +1,12 @@ -import os, string +import string + # Nifty trick from http://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename-in-python def validate_filename(filename): valid_chars = "-_.()%s%s" % (string.ascii_letters, string.digits) return ''.join(c for c in filename if c in valid_chars) + def black_page(): filepath = "/tmp/screenly_html/black_page.html" html = "" @@ -13,15 +15,12 @@ def black_page(): f.close() return filepath + def image_page(image, name): filename = validate_filename(name) full_filename = '/tmp/screenly_html/' + filename + '.html' - html = "" % image + html = "" % image f = open(full_filename, 'w') f.write(html) f.close() return full_filename - - - -