summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Mencl <vladimir.mencl@reannz.co.nz>2021-06-09 22:21:16 +1200
committerVlad Mencl <vladimir.mencl@reannz.co.nz>2021-06-09 22:21:16 +1200
commita084c8f9f8922ec8292ee71c75a12c254be19758 (patch)
tree544461dd7c7c61dc9b007eaacc25ac05d884f75e
parentf72e286fca31750c680f23b7ca0dc3eb8af31449 (diff)
downloadpysaml2-a084c8f9f8922ec8292ee71c75a12c254be19758.tar.gz
fix: mdstore: fix MetadataStore.dumps(format="md")
MetadataStore.dumps(format="md") was failing with TypeError: Object of type dict_items is not JSON serializable ... because self.items() returns dictitems() - while only a dict would be serializable into JSON. Convert the dictitems back into a dict.
-rw-r--r--src/saml2/mdstore.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/saml2/mdstore.py b/src/saml2/mdstore.py
index f3f26546..999d1ecf 100644
--- a/src/saml2/mdstore.py
+++ b/src/saml2/mdstore.py
@@ -1693,4 +1693,5 @@ class MetadataStore(MetaData):
return "%s" % res
elif format == "md":
- return json.dumps(self.items(), indent=2)
+ # self.items() returns dictitems(), convert that back into a dict
+ return json.dumps(dict(self.items()), indent=2)