More robust parsing of legacy config - toot - Unnamed repository; edit this file 'description' to name the repository.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 536328f56b3050e966ff44f3127e8270cad61dd6
(DIR) parent f976e7c818ca6d1da11116758ab056c20e36e5ca
(HTM) Author: Ivan Habunek <ivan@habunek.com>
Date: Sun, 14 Jan 2018 13:04:04 +0100
More robust parsing of legacy config
Diffstat:
toot/config_legacy.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/toot/config_legacy.py b/toot/config_legacy.py
@@ -20,7 +20,10 @@ def load_user(path):
with open(path, 'r') as f:
lines = f.read().split()
- return User(*lines)
+ try:
+ return User(*lines)
+ except TypeError:
+ return None
def load_apps(path):
@@ -30,7 +33,10 @@ def load_apps(path):
for name in os.listdir(path):
with open(path + name) as f:
values = f.read().split()
- yield App(*values)
+ try:
+ yield App(*values)
+ except TypeError:
+ pass
def add_username(user, apps):