From f9225aa2dd2e1950750429c0bdc58fae1f1af634 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Tue, 8 Dec 2015 09:29:38 +0100 Subject: [PATCH] [enh] static helper class for templates --- prosopopoee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/prosopopoee b/prosopopoee index 151eaeb..d3e65b1 100755 --- a/prosopopoee +++ b/prosopopoee @@ -12,6 +12,17 @@ index_template = templates.get_template("index.html") gallery_index_template = templates.get_template("gallery-index.html") +class TemplateFunctions(): + def __init__(self, base_dir, target_dir): + self.base_dir = base_dir + self.target_dir = target_dir + + def copy_image(self, image): + shutil.copyfile(os.path.join(self.base_dir, image), os.path.join(self.target_dir, image)) + print os.path.join(self.base_dir, image), "->", os.path.join(self.target_dir, image) + return "" + + def error(test, error_message): if not test: sys.stderr.write(error_message)