Revision: 6481
Author:   russblau
Date:     2009-03-03 18:48:44 +0000 (Tue, 03 Mar 2009)

Log Message:
-----------
fix sorting problem (if the pages come in the form of a dict, there is no way 
to recover the original order in which the API returned them, so we sort by the 
dict's keys for lack of a better option)

Modified Paths:
--------------
    branches/rewrite/pywikibot/data/api.py

Modified: branches/rewrite/pywikibot/data/api.py
===================================================================
--- branches/rewrite/pywikibot/data/api.py      2009-03-03 16:50:18 UTC (rev 
6480)
+++ branches/rewrite/pywikibot/data/api.py      2009-03-03 18:48:44 UTC (rev 
6481)
@@ -443,9 +443,7 @@
                 logger.debug(u"%s received %s; limit=%s"
                               % (self.__class__.__name__, pagedata.keys(),
                                  self.limit))
-                pagedata = pagedata.values()
-                if self.resultkey == "pages":
-                    pagedata.sort(key=lambda i:int(i["pageid"]))
+                pagedata = [pagedata[k] for k in sorted(pagedata.keys())]
             else:
                 logger.debug(u"%s received %s; limit=%s"
                               % (self.__class__.__name__, pagedata, 
self.limit))



_______________________________________________
Pywikipedia-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l

Reply via email to