From 3cc575bb8532d3fed5a4d310b8b3c5818486860a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 8 Apr 2024 15:08:19 +0100 Subject: [PATCH] Tidying --- daemon_get.py | 5 ++++- daemon_get_css.py | 14 ++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/daemon_get.py b/daemon_get.py index 3fbf96f09..535ed3aba 100644 --- a/daemon_get.py +++ b/daemon_get.py @@ -1270,7 +1270,10 @@ def daemon_http_get(self) -> None: if self.path.endswith('.css'): if get_style_sheet(self, self.server.base_dir, calling_domain, self.path, - getreq_start_time): + getreq_start_time, + self.server.debug, + self.server.css_cache, + self.server.fitness): return if authorized and '/exports/' in self.path: diff --git a/daemon_get_css.py b/daemon_get_css.py index aa1aef710..78be56b1c 100644 --- a/daemon_get_css.py +++ b/daemon_get_css.py @@ -20,7 +20,9 @@ from daemon_utils import etag_exists def get_style_sheet(self, base_dir: str, calling_domain: str, path: str, - getreq_start_time) -> bool: + getreq_start_time, debug: bool, + css_cache: {}, + fitness: {}) -> bool: """Returns the content of a css file """ # get the last part of the path @@ -29,15 +31,15 @@ def get_style_sheet(self, base_dir: str, calling_domain: str, path: str, path = path.split('/')[-1] path = base_dir + '/' + path css = None - if self.server.css_cache.get(path): - css = self.server.css_cache[path] + if css_cache.get(path): + css = css_cache[path] elif os.path.isfile(path): tries = 0 while tries < 5: try: css = get_css(base_dir, path) if css: - self.server.css_cache[path] = css + css_cache[path] = css break except BaseException as ex: print('EX: _get_style_sheet ' + path + ' ' + @@ -51,9 +53,9 @@ def get_style_sheet(self, base_dir: str, calling_domain: str, path: str, None, calling_domain, False) write2(self, msg) fitness_performance(getreq_start_time, - self.server.fitness, + fitness, '_GET', '_get_style_sheet', - self.server.debug) + debug) return True http_404(self, 92) return True