diff options
author | emkael <emkael@tlen.pl> | 2019-12-30 12:49:54 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-12-30 12:49:54 +0100 |
commit | 7a598f65372b1b694d222946fd6269033bde0e54 (patch) | |
tree | e33fb74aad63756f0b3c94f12e29aff6c97064ed /jfr_playoff/data/info.py | |
parent | f77bac9b5406c6bf6b1c819f155164568ef4af36 (diff) |
New package structure for result info classes
Diffstat (limited to 'jfr_playoff/data/info.py')
-rw-r--r-- | jfr_playoff/data/info.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/jfr_playoff/data/info.py b/jfr_playoff/data/info.py new file mode 100644 index 0000000..371ac6a --- /dev/null +++ b/jfr_playoff/data/info.py @@ -0,0 +1,29 @@ +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 |