From b3d5fee708d7f2eb60c7cd5b94baac36eb587ec4 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Wed, 16 Jan 2013 21:13:28 +0000 Subject: [PATCH] Fix image page comment, remove unused import. --- html_templates.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 - - - -