From 175be53209b13eaec92ef8b3c0bad8a17dfc7a97 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 10 Aug 2023 23:16:20 +0200 Subject: ignore old obscure changes in the state file --- geldschieberbot.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'geldschieberbot.py') diff --git a/geldschieberbot.py b/geldschieberbot.py index 39352d2..2853379 100644 --- a/geldschieberbot.py +++ b/geldschieberbot.py @@ -153,14 +153,18 @@ class Geldschieberbot: except (KeyError, TypeError): # convert from old plain changes format if isinstance(list(self.state['changes'].values())[0], list): - self.state['changes'] = { - name: [ - Change(ch[0], - [Modification(r, d, a) - for r, d, a in ch[1:]], None) for ch in changes - ] - for name, changes in self.state['changes'].items() - } + for name, changes in self.state['changes'].items(): + user_changes = [] + for ch in changes: + try: + user_changes.append( + Change(ch[0], [ + Modification(r, d, a) for r, d, a in ch[1:] + ], None)) + except (ValueError, TypeError): + continue + + self.state['changes'][name] = user_changes for key in self.STATE_KEYS: # add missing keys to an existsing state -- cgit v1.2.3