summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-01-05 17:21:47 +0100
committeremkael <emkael@tlen.pl>2020-01-05 17:21:47 +0100
commitf90884a97abf9e2dabdfe90cb3704c551fedfbc9 (patch)
tree60865b5a4fa396b7ca74a00cae7d35848b0d3812
parent856cf764545362dd43cd2f304bd73c4594e1e6e8 (diff)
Clearing remote content cache on each GUI run
Fixes #45
-rw-r--r--jfr_playoff/gui/__init__.py2
-rw-r--r--jfr_playoff/remote.py4
2 files changed, 6 insertions, 0 deletions
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 = {}