Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/151410

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/quarry/web 
refs/changes/10/151410/1

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: newchange
Gerrit-Change-Id: I7f5c427fd41aa56dfda561e2c49ba05b2a3dd242
Gerrit-PatchSet: 1
Gerrit-Project: analytics/quarry/web
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to