Revision: 7704
Author: xqt
Date: 2009-11-27 09:02:00 +0000 (Fri, 27 Nov 2009)
Log Message:
-----------
hints is used globally; put it to the container
Modified Paths:
--------------
trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py
===================================================================
--- trunk/pywikipedia/interwiki.py 2009-11-26 15:49:06 UTC (rev 7703)
+++ trunk/pywikipedia/interwiki.py 2009-11-27 09:02:00 UTC (rev 7704)
@@ -518,9 +518,7 @@
skipauto = False
untranslated = False
untranslatedonly = False
- askhints = False
auto = True
- hintnobracket = False
neverlink = []
showtextlink = 0
showtextlinkadd = 300
@@ -534,6 +532,9 @@
followinterwiki = True
minsubjects = config.interwiki_min_subjects
nobackonly = False
+ askhints = False
+ hintnobracket = False
+ hints = []
hintsareright = False
contentsondisk = config.interwiki_contents_on_disk
lacklanguage = None
@@ -1787,7 +1788,7 @@
if self.generateUntil:
if page.titleWithoutNamespace() > self.generateUntil:
raise StopIteration
- self.add(page, hints = hints)
+ self.add(page, hints = globalvar.hints)
self.generated += 1
if self.generateNumber:
if self.generated >= self.generateNumber:
@@ -1986,7 +1987,6 @@
if __name__ == "__main__":
try:
singlePageTitle = []
- hints = []
start = None
# Which namespaces should be processed?
# default to [] which means all namespaces will be processed
@@ -2015,7 +2015,7 @@
elif arg == '-noauto':
globalvar.auto = False
elif arg.startswith('-hint:'):
- hints.append(arg[6:])
+ globalvar.hints.append(arg[6:])
elif arg.startswith('-hintfile'):
hintfilename = arg[10:]
if (hintfilename is None) or (hintfilename == ''):
@@ -2023,7 +2023,7 @@
f = codecs.open(hintfilename, 'r', config.textfile_encoding)
R = re.compile(ur'\[\[(.+?)(?:\]\]|\|)') # hint or title ends
either before | or before ]]
for pageTitle in R.findall(f.read()):
- hints.append(pageTitle)
+ globalvar.hints.append(pageTitle)
f.close()
elif arg == '-force':
globalvar.force = True
@@ -2223,7 +2223,7 @@
if not singlePageTitle:
singlePageTitle = pywikibot.input(u'Which page to check:')
singlePage = pywikibot.Page(pywikibot.getSite(), singlePageTitle)
- bot.add(singlePage, hints = hints)
+ bot.add(singlePage, hints = globalvar.hints)
try:
try:
Show replies by date