summaryrefslogtreecommitdiff
path: root/jfr_playoff/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'jfr_playoff/data.py')
-rw-r--r--jfr_playoff/data.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/jfr_playoff/data.py b/jfr_playoff/data.py
index 6649e68..132ee02 100644
--- a/jfr_playoff/data.py
+++ b/jfr_playoff/data.py
@@ -1,10 +1,40 @@
+from jfr_playoff.logger import PlayoffLogger
+
+
+class ResultInfo(object):
+ def __init__(self, *args):
+ self.clients = self.fill_client_list(*args)
+
+ def fill_client_list(self, settings, database):
+ return []
+
+ def call_client(self, method, default, *args):
+ PlayoffLogger.get('resultinfo').info(
+ 'calling %s on result info clients', method)
+ for client in self.clients:
+ try:
+ ret = getattr(client, method)(*args)
+ PlayoffLogger.get('resultinfo').info(
+ '%s method returned %s', method, ret)
+ return ret
+ except Exception as e:
+ if type(e) in client.get_exceptions(method):
+ PlayoffLogger.get('resultinfo').warning(
+ '%s method raised %s(%s)',
+ method, type(e).__name__, str(e))
+ else:
+ raise
+ PlayoffLogger.get('resultinfo').info(
+ '%s method returning default: %s', method, default)
+ return default
+
+
from cached_property import cached_property
from jfr_playoff.db import PlayoffDB
from jfr_playoff.dto import Phase
from jfr_playoff.matchinfo import MatchInfo
from jfr_playoff.tournamentinfo import TournamentInfo
-from jfr_playoff.logger import PlayoffLogger
class PlayoffData(object):