Skip to content

Commit b05cef7

Browse files
committed
fixes
1 parent 6621ee6 commit b05cef7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Lib/gftools/fontsetter.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,26 @@ def hasmethod(obj, name):
3333

3434

3535
def update_all(obj, config):
36+
obj = [obj]
3637
for path, value in config.items():
3738
update(obj, path, value)
38-
39+
obj = obj[0]
3940

4041
def update(obj, path, val):
4142
if len(path) == 0:
4243
return
4344
key = path[0]
4445

4546
if len(path) == 1:
46-
if hasmethod(obj, key):
47+
if isinstance(key, str) and hasmethod(obj, key):
4748
getattr(obj, key)(*val)
48-
elif hasattr(obj, key):
49+
elif isinstance(key, str) and hasattr(obj, key):
4950
setattr(obj, key, val)
5051
else:
5152
obj[path[0]] = val
5253
return
5354

54-
if hasattr(obj, key):
55+
if isinstance(key, str) and hasattr(obj, key):
5556
update(getattr(obj, key), path[1:])
5657
elif isinstance(obj, (list, dict, tuple, TTFont)):
5758
is_tuple = False

0 commit comments

Comments
 (0)