[mod] self note on optimisation

This commit is contained in:
Laurent Peuch 2015-12-11 09:13:52 +01:00
parent 8175ed4de7
commit 2f0757e2a4

View File

@ -18,8 +18,15 @@ class TemplateFunctions():
self.target_dir = target_dir self.target_dir = target_dir
def copy_image(self, image): def copy_image(self, image):
shutil.copyfile(os.path.join(self.base_dir, image), os.path.join(self.target_dir, image)) source, target = 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)
# XXX doing this DOESN'T improve perf at all (or something like 0.1%)
# if os.path.exists(target) and os.path.getsize(source) == os.path.getsize(target):
# print "Skiped %s since the file hasn't been modified based on file size" % source
# return ""
shutil.copyfile(source, target)
print source, "->", target
return "" return ""
def generate_thumbnail(self, image, gm_geometry): def generate_thumbnail(self, image, gm_geometry):