Ricordisamoa has submitted this change and it was merged. Change subject: Allow to serialize Element objects as JSON ......................................................................
Allow to serialize Element objects as JSON The API is currently failing because of tritium: (it shouldn't be there, by the way) https://tools.wmflabs.org/ptable/api?props=incomplete Change-Id: I1cba28bc178f883bbb430dab6bb6bea8f06e4302 --- M app.py 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Ricordisamoa: Verified; Looks good to me, approved Lucie Kaffee: Looks good to me, but someone else must approve diff --git a/app.py b/app.py index 5b9ed06..00ad692 100644 --- a/app.py +++ b/app.py @@ -24,7 +24,7 @@ class CustomJSONEncoder(JSONEncoder): def default(self, obj): - if isinstance(obj, chemistry.TableCell): + if isinstance(obj, (chemistry.Element, chemistry.TableCell)): return obj.__dict__ return super(CustomJSONEncoder, self).default(obj) -- To view, visit https://gerrit.wikimedia.org/r/225269 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1cba28bc178f883bbb430dab6bb6bea8f06e4302 Gerrit-PatchSet: 1 Gerrit-Project: labs/tools/ptable Gerrit-Branch: master Gerrit-Owner: Ricordisamoa <ricordisa...@openmailbox.org> Gerrit-Reviewer: Lucie Kaffee <lucie.kaf...@wikimedia.de> Gerrit-Reviewer: Ricordisamoa <ricordisa...@openmailbox.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits