[Pywikipedia-l] SVN: [4730] trunk/pywikipedia/catlib.py

rotem at svn.wikimedia.org rotem at svn.wikimedia.org
Tue Dec 18 17:36:13 UTC 2007


Revision: 4730
Author:   rotem
Date:     2007-12-18 17:36:07 +0000 (Tue, 18 Dec 2007)

Log Message:
-----------
(bug 1850347) Compatibility with images in categories.

Modified Paths:
--------------
    trunk/pywikipedia/catlib.py

Modified: trunk/pywikipedia/catlib.py
===================================================================
--- trunk/pywikipedia/catlib.py	2007-12-18 17:20:11 UTC (rev 4729)
+++ trunk/pywikipedia/catlib.py	2007-12-18 17:36:07 UTC (rev 4730)
@@ -247,7 +247,10 @@
             if Rimage:
                 # For MediaWiki versions where images work through galleries
                 for title in Rimage.findall(txt):
-                    yield ARTICLE, wikipedia.ImagePage(self.site(), "Image:%s" % title)
+                    # In some MediaWiki versions, the titles contain the namespace,
+                    # but they don't in other (newer) versions. Use the ImagePage's
+                    # defaultNamespace feature to get everything correctly.
+                    yield ARTICLE, wikipedia.ImagePage(self.site(), title)
             # try to find a link to the next list page
             # If skippedCategoryDescription is False, then there are no pages
             # or subcategories, so there cannot be a next list page





More information about the Pywikipedia-l mailing list