BryanDavis has uploaded a new change for review.

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

Change subject: Maintain file order when iterating wikiversions.json
......................................................................

Maintain file order when iterating wikiversions.json

Load wikiversions.json as an ordered dict to preserve php behavior of
iterating the dict in the order that is given in the json file. This
insanity brought to you by the variance of generating ExtensionMessages
with different wikidb versions.

Bug: 63659
Change-Id: I3c5ca78ae624f8027e8dc3c0a13212987edad477
---
M scap/cli.py
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/scap 
refs/changes/00/124500/1

diff --git a/scap/cli.py b/scap/cli.py
index 920c120..d84d0f3 100644
--- a/scap/cli.py
+++ b/scap/cli.py
@@ -10,6 +10,7 @@
 import distutils.version
 import json
 import logging
+import operator
 import os
 import sys
 
@@ -73,7 +74,12 @@
             self.config['wmf_realm'], self.config['datacenter'])
 
         with open(path) as f:
-            wikiversions = json.load(f)
+            # Bug 63659: Load json into an ordered dict to preserve php
+            # behavior of iterating the dict in the order that is given in the
+            # json file. This insanity brought to you by the variance of
+            # generating ExtensionMessages with different wikidb versions.
+            wikiversions = json.load(
+                f, object_pairs_hook=collections.OrderedDict)
 
         versions = {}
         for wikidb, version in wikiversions.items():

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c5ca78ae624f8027e8dc3c0a13212987edad477
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/scap
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>

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

Reply via email to