diff options
author | Michał Klichowicz <emkael@tlen.pl> | 2024-04-13 13:17:56 +0200 |
---|---|---|
committer | Michał Klichowicz <emkael@tlen.pl> | 2024-04-13 13:17:56 +0200 |
commit | 40eaf8435414c6f0a3c7968942b90b5fa85f4d44 (patch) | |
tree | 3434b04818020210cc08de3c75a8e16695ee7a66 /jfr_playoff/dto.py | |
parent | f83effb4242a9230b30ec1177bc61bf921b3b45b (diff) |
In a console-less setup, e.g. GUI, revert to any sane log encoding
Fixes #55
Diffstat (limited to 'jfr_playoff/dto.py')
-rw-r--r-- | jfr_playoff/dto.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/jfr_playoff/dto.py b/jfr_playoff/dto.py index 44fe8cb..605493a 100644 --- a/jfr_playoff/dto.py +++ b/jfr_playoff/dto.py @@ -1,6 +1,9 @@ from math import ceil, floor import sys +from jfr_playoff.logger import log_encoding + + def coalesce(*arg): for el in arg: if el is not None: @@ -39,7 +42,7 @@ class Team(object): return u'%s (%.1f)' % (coalesce(self.name, '<None>'), self.score) def __repr__(self): - return unicode(self).encode(sys.stdin.encoding) + return unicode(self).encode(log_encoding()) class Match(object): @@ -61,7 +64,7 @@ class Match(object): self.id, coalesce(self.link, '<None>'), [unicode(team) for team in self.teams], u'finished' if self.running < 0 else ( u'%d boards' % self.running)) - ).encode(sys.stdin.encoding) + ).encode(log_encoding()) class Phase(object): |