Last modified: 2014-11-15 13:03:40 UTC
pywikibot.showDiff(oldText, newText) is currently used to compare two wikicode strings. But what about data items? We should either: * use the API to get a diff in structured format (bug 39147), or: * convert dicts to strings somehow, before sending them to difflib More ideas are welcome.
use json.dumps to get a string?
Created attachment 15216 [details] console output by pywikibot.showDiff used on two json.dumps-ed dictionaries (In reply to Betacommand from comment #1) > use json.dumps to get a string? Really? This is a small piece of what I got on my terminal using json.dumps before showDiff, after changing a single alias. We need a smarter function than json.dumps.
thats probably because you didnt configure the dumps for human reading. Try: json.dumps(data, indent=4, sort_keys=True) should give you much cleaner results
Change 160254 had a related patch set uploaded by XZise: [FIX] init: Return valid json in str() for WbTime and WbQuantity https://gerrit.wikimedia.org/r/160254
Change 160254 merged by jenkins-bot: [FIX] init: Return valid json in str() for WbTime and WbQuantity https://gerrit.wikimedia.org/r/160254
more to do