[Pywikipedia-l] SVN: [4734] trunk/pywikipedia/wikipedia.py
rotem at svn.wikimedia.org
rotem at svn.wikimedia.org
Tue Dec 18 18:09:44 UTC 2007
Revision: 4734
Author: rotem
Date: 2007-12-18 18:09:38 +0000 (Tue, 18 Dec 2007)
Log Message:
-----------
(bug 1852173) Fix a problem of a very special case in Allpages, when no pages of the requested type (redirect/non-redirect) are found, and the start parameter remains and gets double-encoded.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-12-18 17:48:42 UTC (rev 4733)
+++ trunk/pywikipedia/wikipedia.py 2007-12-18 18:09:38 UTC (rev 4734)
@@ -4444,8 +4444,14 @@
if (not includeredirects) or includeredirects == 'only':
# Maybe there were only so few because the rest is or is not a redirect
R = re.compile('title ?=\"(.*?)\"')
- if len(R.findall(returned_html)) < 100:
+ allLinks = R.findall(returned_html)
+ if len(allLinks) < 100:
break
+ elif n == 0:
+ # In this special case, no pages of the requested type
+ # were found, and "start" will remain and be double-encoded.
+ # Use the last page as the start of the next page.
+ start = Page(self, allLinks[-1]).titleWithoutNamespace() + '!'
else:
break
More information about the Pywikipedia-l
mailing list