Revision: 4305 Author: cosoleto Date: 2007-09-16 14:04:13 +0000 (Sun, 16 Sep 2007)
Log Message: ----------- Added old code in getVersionHistory() of ImagePage class to improve compatibility (bug #1795683)
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-09-16 10:32:16 UTC (rev 4304) +++ trunk/pywikipedia/wikipedia.py 2007-09-16 14:04:13 UTC (rev 4305) @@ -2168,7 +2168,13 @@
if history: lineR = re.compile('<tr><td>.*?</td><td><a href=".+?">(?P<datetime>.+?)</a></td><td><a href=".+?"(?: class="new"|) title=".+?">(?P<username>.+?)</a>.*?</td><td>(?P<resolution>.*?)</td><td class=".+?">(?P<filesize>.+?)</td><td>(?P<comment>.*?)</td></tr>') + else: + # backward compatible code + history = re.search('(?s)<ul class="special">.+?</ul>', self.getImagePageHtml()) + if history: + lineR = re.compile('<li> (.+?) (.+?) <a href=".+?" title=".+?">(?P<datetime>.+?)</a> . . <a href=".+?" title=".+?">(?P<username>.+?)</a> (.+?) . . (?P<resolution>\d+.+?\d+) ((?P<filesize>[\d,.]+) .+?)( <span class="comment">(?P<comment>.*?)</span>)?</li>')
+ if history: for match in lineR.finditer(history.group()): datetime = match.group('datetime') username = match.group('username')