[Pywikipedia-l] SVN: [6077] trunk/pywikipedia/commonsdelinker/checkusage.py

btongminh at svn.wikimedia.org btongminh at svn.wikimedia.org
Fri Nov 7 22:36:51 UTC 2008


Revision: 6077
Author:   btongminh
Date:     2008-11-07 22:36:51 +0000 (Fri, 07 Nov 2008)

Log Message:
-----------
Compatibility with multiple versions of mediawiki

Modified Paths:
--------------
    trunk/pywikipedia/commonsdelinker/checkusage.py

Modified: trunk/pywikipedia/commonsdelinker/checkusage.py
===================================================================
--- trunk/pywikipedia/commonsdelinker/checkusage.py	2008-11-07 15:56:44 UTC (rev 6076)
+++ trunk/pywikipedia/commonsdelinker/checkusage.py	2008-11-07 22:36:51 UTC (rev 6077)
@@ -351,7 +351,11 @@
 			
 		usages = res['query'].get('imageusage')
 		if not usages: return
-			
+		
+		# Apparently this someday changed from dict to list?
+		if type(usages) is dict:
+			uages = usages.values()
+		
 		for usage in usages.itervalues():
 			title = usage['title'].replace(' ', '_')
 			namespace = usage['ns']





More information about the Pywikipedia-l mailing list