From dfb21c3c46c8e08c50e9b0d08f4c3dbdceb6a72a Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 17 Oct 2017 18:46:05 +0200 Subject: [PATCH] Don't keep files in memory when not using cache --- common.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common.py b/common.py index 92c0801..2e0e043 100644 --- a/common.py +++ b/common.py @@ -50,7 +50,8 @@ class Model: #decorators with parameters: def withResource(path, binary=False): - data = readfile(os.path.join(config.resourcedir, path), binary) + if config.cache: + data = readfile(os.path.join(config.resourcedir, path), binary) def decorator(func): def newfunc(*args, **kwargs): @@ -67,7 +68,8 @@ def withResource(path, binary=False): return decorator def withTemplate(path, isHTML=True): - template = airspeed.Template(readfile(os.path.join(config.resourcedir, path))) + if config.cache: + template = airspeed.Template(readfile(os.path.join(config.resourcedir, path))) def decorator(func): def newfunc(*args, **kwargs):