Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2023-03-26 22:05:52 +0200
committerGitHub <noreply@github.com>2023-03-26 22:05:52 +0200
commitef5011114d7ecfbfd81d154fc985b1f2d345c3cc (patch)
tree305d1f47393da6f0322ca3bb62b4d40b5c0c94e0 /archinstall
parent942112f871ee625f21146f444dd19d08f8640c5e (diff)
Improved handling of .json() helper handling. By dumping it with the JsonEncoder and loading it back in we ensure that any recursive objects also meers the json friendly dict criterias. (#1689)
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/general.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index 79693dcb..79ab024b 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -130,7 +130,10 @@ class JsonEncoder:
copy[JsonEncoder._encode(key)] = val
return copy
elif hasattr(obj, 'json'):
- return obj.json()
+ # json() is a friendly name for json-helper, it should return
+ # a dictionary representation of the object so that it can be
+ # processed by the json library.
+ return json.loads(json.dumps(obj.json(), cls=JSON))
elif hasattr(obj, '__dump__'):
return obj.__dump__()
elif isinstance(obj, (datetime, date)):