From f90884a97abf9e2dabdfe90cb3704c551fedfbc9 Mon Sep 17 00:00:00 2001 From: emkael Date: Sun, 5 Jan 2020 17:21:47 +0100 Subject: Clearing remote content cache on each GUI run Fixes #45 --- jfr_playoff/gui/__init__.py | 2 ++ jfr_playoff/remote.py | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'jfr_playoff') diff --git a/jfr_playoff/gui/__init__.py b/jfr_playoff/gui/__init__.py index 5d9e40f..70b8ac8 100644 --- a/jfr_playoff/gui/__init__.py +++ b/jfr_playoff/gui/__init__.py @@ -11,6 +11,7 @@ import tkMessageBox as tkmb from jfr_playoff.filemanager import PlayoffFileManager from jfr_playoff.generator import PlayoffGenerator +from jfr_playoff.remote import RemoteUrl as p_remote from jfr_playoff.settings import PlayoffSettings from .tabs import * @@ -185,6 +186,7 @@ class PlayoffGUI(tk.Tk): self._tempPath = os.path.join( tempDir, next(tempfile._get_candidate_names())) config['output'] = self._tempPath + '.html' + p_remote.clear_cache() settings = PlayoffSettings(config_obj=config) generator = PlayoffGenerator(settings) content = generator.generate_content() diff --git a/jfr_playoff/remote.py b/jfr_playoff/remote.py index 6fb7e36..74d75b5 100644 --- a/jfr_playoff/remote.py +++ b/jfr_playoff/remote.py @@ -29,3 +29,7 @@ class RemoteUrl: @classmethod def fetch(cls, url): return bs(RemoteUrl.fetch_raw(url), 'lxml') + + @classmethod + def clear_cache(cls): + cls.url_cache = {} -- cgit v1.2.3