[Pywikipedia-l] SVN: [5429] trunk/pywikipedia/wikipedia.py

nicdumz at svn.wikimedia.org nicdumz at svn.wikimedia.org
Thu May 22 19:05:38 UTC 2008


Revision: 5429
Author:   nicdumz
Date:     2008-05-22 19:05:37 +0000 (Thu, 22 May 2008)

Log Message:
-----------
attempting to fix getFileHistory

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2008-05-22 18:55:08 UTC (rev 5428)
+++ trunk/pywikipedia/wikipedia.py	2008-05-22 19:05:37 UTC (rev 5429)
@@ -2586,7 +2586,10 @@
         result = []
         history = re.search('(?s)<table class="filehistory">.+?</table>', self.getImagePageHtml())
         if history:
-            lineR = re.compile(r'<tr>(?:<td>.*?</td>){1,2}<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>')
+            lineR = re.compile(r'<tr>(?:<td>.*?</td>){1,2}<td.*?><a href=".+?">(?P<datetime>.+?)</a></td><td>(?P<resolution>.*?)<span.*?>\((?P<filesize>.+?)\)</span></td><td><a href=".+?"(?: class="new"|) title=".+?">(?P<username>.+?)</a>.*?</td><td>.*?<span class="comment">(?P<comment>.*?)</span></td></tr>')
+            if not lineR.search(history.group()):
+                # b/c code
+                lineR = re.compile(r'<tr>(?:<td>.*?</td>){1,2}<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())





More information about the Pywikipedia-l mailing list