Nuria has uploaded a new change for review.

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

Change subject: Undoing  Ide98e20eb54523353153ccd212df5...
......................................................................

Undoing  Ide98e20eb54523353153ccd212df5...

It is breaking several pages in production

Make non-ascii characters display correctly in json reports

Bug: T93023
Change-Id: I4f1cfc283f96acaf5de89cac8d5801328f40572f
---
M wikimetrics/controllers/reports.py
M wikimetrics/utils.py
2 files changed, 4 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/wikimetrics 
refs/changes/14/204214/1

diff --git a/wikimetrics/controllers/reports.py 
b/wikimetrics/controllers/reports.py
index c2683a2..812c88d 100644
--- a/wikimetrics/controllers/reports.py
+++ b/wikimetrics/controllers/reports.py
@@ -402,12 +402,9 @@
     new_individual_ids = {}
     for individual in json_result['result'][Aggregation.IND]:
         user_name = user_names[WikiUserKey.fromstr(individual)]
-        # concatenating string and unicode types produces string types
-        # make sure to concatenate only unicode types
-        individual = individual.decode('utf-8')
-        user_name = user_name.decode('utf-8')
-
-        new_id_string = u'{}|{}'.format(user_name, individual)
+        
+        new_id_string = '{}|{}'.format(user_name, individual)
+        
         new_individual_ids[individual] = new_id_string
 
     json_with_names = deepcopy(json_result)
diff --git a/wikimetrics/utils.py b/wikimetrics/utils.py
index 4eee4ec..d093fd9 100644
--- a/wikimetrics/utils.py
+++ b/wikimetrics/utils.py
@@ -44,7 +44,7 @@
 
 
 def json_string(obj):
-    return json.dumps(obj, cls=BetterEncoder, indent=4, ensure_ascii=False)
+    return json.dumps(obj, cls=BetterEncoder, indent=4)
 
 
 def stringify(*args, **kwargs):

-- 
To view, visit https://gerrit.wikimedia.org/r/204214
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f1cfc283f96acaf5de89cac8d5801328f40572f
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wikimetrics
Gerrit-Branch: master
Gerrit-Owner: Nuria <[email protected]>

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

Reply via email to