From 9a24c8dec5259f4d7c07d7197bafd67e46c6d411 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Sun, 28 Feb 2016 09:49:02 +0100 Subject: [PATCH] [fix] text is not an option that makes sens to cache --- prosopopee/cache.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/prosopopee/cache.py b/prosopopee/cache.py index c8de61d..cfe73c4 100644 --- a/prosopopee/cache.py +++ b/prosopopee/cache.py @@ -4,9 +4,11 @@ import json CACHE_VERSION = 2 -def remove_name(options): +def remove_superficial_options(options): noname_options = options.copy() del noname_options["name"] + if "text" in noname_options: + del noname_options["text"] return noname_options @@ -37,13 +39,13 @@ class Cache(object): cached_picture = self.cache[target] - if cached_picture["size"] != os.path.getsize(source) or cached_picture["options"] != remove_name(options): + if cached_picture["size"] != os.path.getsize(source) or cached_picture["options"] != remove_superficial_options(options): return True return False def cache_picture(self, source, target, options): - self.cache[target] = {"size": os.path.getsize(source), "options": remove_name(options)} + self.cache[target] = {"size": os.path.getsize(source), "options": remove_superficial_options(options)} def __del__(self): self.json.dump(self.cache, open(self.cache_file_path, "w"))