Revision: 5542 Author: cosoleto Date: 2008-06-09 09:57:40 +0000 (Mon, 09 Jun 2008)
Log Message: ----------- Fixed bug #1982714 - 'Media on shared repos not recognised by framework'. ImagePage::usingPages() was broken due to MediaWiki new version. Commons links in HTML text was recognized as internal
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-06-08 21:56:51 UTC (rev 5541) +++ trunk/pywikipedia/wikipedia.py 2008-06-09 09:57:40 UTC (rev 5542) @@ -2621,10 +2621,11 @@
def usingPages(self): """Yield Pages on which the image is displayed.""" - titleList = re.search('(?s)<h2 id="filelinks">.+?</ul>', + titleList = re.search('(?s)<h2 id="filelinks">.+?<!-- end content -->', self.getImagePageHtml()).group() lineR = re.compile( - '<li><a href=".+?" title=".+?">(?P<title>.+?)</a></li>') + '<li><a href="[^"]+?" title=".+?">(?P<title>.+?)</a></li>') + for match in lineR.finditer(titleList): try: yield Page(self.site(), match.group('title'))