mirror of
https://github.com/ihabunek/toot
synced 2025-02-03 20:57:38 +01:00
More robust parsing of legacy config
This commit is contained in:
parent
f976e7c818
commit
536328f56b
@ -20,7 +20,10 @@ def load_user(path):
|
|||||||
|
|
||||||
with open(path, 'r') as f:
|
with open(path, 'r') as f:
|
||||||
lines = f.read().split()
|
lines = f.read().split()
|
||||||
return User(*lines)
|
try:
|
||||||
|
return User(*lines)
|
||||||
|
except TypeError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def load_apps(path):
|
def load_apps(path):
|
||||||
@ -30,7 +33,10 @@ def load_apps(path):
|
|||||||
for name in os.listdir(path):
|
for name in os.listdir(path):
|
||||||
with open(path + name) as f:
|
with open(path + name) as f:
|
||||||
values = f.read().split()
|
values = f.read().split()
|
||||||
yield App(*values)
|
try:
|
||||||
|
yield App(*values)
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def add_username(user, apps):
|
def add_username(user, apps):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user