jenkins-bot has submitted this change and it was merged.
Change subject: Add decimal support to the JSON encoder
......................................................................
Add decimal support to the JSON encoder
Change-Id: I7f5c427fd41aa56dfda561e2c49ba05b2a3dd242
---
M quarry/web/models/queryresult.py
1 file changed, 3 insertions(+), 0 deletions(-)
Approvals:
Yuvipanda: Looks good to me, approved
jenkins-bot: Verified
diff --git a/quarry/web/models/queryresult.py b/quarry/web/models/queryresult.py
index e0e7dfc..86630fd 100644
--- a/quarry/web/models/queryresult.py
+++ b/quarry/web/models/queryresult.py
@@ -1,6 +1,7 @@
import json
import os
import datetime
+import decimal
class MoreAcceptingJSONEncoder(json.JSONEncoder):
@@ -11,6 +12,8 @@
return obj.isoformat()
elif isinstance(obj, datetime.timedelta):
return (datetime.datetime.min + obj).time().isoformat()
+ elif isinstance(obj, decimal.Decimal):
+ return str(obj)
else:
return super(MoreAcceptingJSONEncoder, self).default(obj)
--
To view, visit https://gerrit.wikimedia.org/r/151410
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7f5c427fd41aa56dfda561e2c49ba05b2a3dd242
Gerrit-PatchSet: 1
Gerrit-Project: analytics/quarry/web
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits