[Pywikipedia-l] SVN: [4860] trunk/pywikipedia
rotem at svn.wikimedia.org
rotem at svn.wikimedia.org
Sat Jan 12 17:43:36 UTC 2008
Revision: 4860
Author: rotem
Date: 2008-01-12 17:43:36 +0000 (Sat, 12 Jan 2008)
Log Message:
-----------
Fixing the second problem in bug 1867483, about the startFrom parameter not being encoded when getting a category members, removing an unnecessary message, and several code fixes.
Modified Paths:
--------------
trunk/pywikipedia/catlib.py
trunk/pywikipedia/speedy_delete.py
Modified: trunk/pywikipedia/catlib.py
===================================================================
--- trunk/pywikipedia/catlib.py 2008-01-12 17:23:56 UTC (rev 4859)
+++ trunk/pywikipedia/catlib.py 2008-01-12 17:43:36 UTC (rev 4860)
@@ -14,7 +14,7 @@
#
__version__ = '$Id$'
#
-import re, time
+import re, time, urllib
import wikipedia
try:
set # introduced in Python 2.4: faster and future
@@ -179,7 +179,10 @@
# regular expression matching the "(next 200)" link
RLinkToNextPage = re.compile('&from=(.*?)" title="');
- currentPageOffset = startFrom
+ if startFrom:
+ currentPageOffset = urllib.quote(startFrom.encode(self.site().encoding()))
+ else:
+ currentPageOffset = None
while True:
path = self.site().get_address(self.urlname())
if purge:
@@ -244,7 +247,6 @@
matchObj = RLinkToNextPage.search(txt)
if matchObj:
currentPageOffset = matchObj.group(1)
- wikipedia.output('There are more articles in %s.' % self.title())
else:
break
Modified: trunk/pywikipedia/speedy_delete.py
===================================================================
--- trunk/pywikipedia/speedy_delete.py 2008-01-12 17:23:56 UTC (rev 4859)
+++ trunk/pywikipedia/speedy_delete.py 2008-01-12 17:43:36 UTC (rev 4860)
@@ -264,7 +264,7 @@
reason = self.getReasonForDeletion(page)
wikipedia.output(u'The chosen reason is: \03{lightred}%s\03{default}' % reason)
page.delete(reason, prompt = False)
- elif choice == 's' or True:
+ else:
wikipedia.output(u'Skipping page %s' % page.title())
startFromBeginning = True
if count == 0:
@@ -274,13 +274,13 @@
else:
startFromBeginning = True
wikipedia.output(u'Quitting program.')
-
+
def refreshGenerator(self):
generator = pagegenerators.CategorizedPageGenerator(self.csdCat, start = self.savedProgress)
# wrap another generator around it so that we won't produce orphaned talk pages.
generator2 = pagegenerators.PageWithTalkPageGenerator(generator)
self.preloadingGen = pagegenerators.PreloadingGenerator(generator2, pageNumber = 20)
-
+
def main():
# read command line parameters
for arg in wikipedia.handleArgs():
More information about the Pywikipedia-l
mailing list