https://bugzilla.wikimedia.org/show_bug.cgi?id=55882
Web browser: --- Bug ID: 55882 Summary: The order of parameters is lost when using templatesWithParams Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: crangasi2001@yahoo.com Blocks: 55880 Classification: Unclassified Mobile Platform: ---
In compat, templatesWithParams from class Page used to provide a pair containing the template name and a list of parameters, with the full "key=value" string. Nowadays, we're getting a dictionary instead of that list. Normally there is nothing wrong with that, except that in Python 2 the dictionary is unordered, which means that:
* the order of the parameters is forever lost - this can be easily solved using OrderedDict instead.
* the original text cannot be reconstructed (because of the above and the missing whitespace information) - this means there is no easy way to identify and/or replace a particular instance of the template in a page with many identical templates.