[Pywikipedia-l] SVN: [6288] trunk/pywikipedia/interwiki.py
purodha at svn.wikimedia.org
purodha at svn.wikimedia.org
Fri Jan 23 16:00:52 UTC 2009
Revision: 6288
Author: purodha
Date: 2009-01-23 16:00:52 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
Cannot use page generator for hintfile.
Modified Paths:
--------------
trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py
===================================================================
--- trunk/pywikipedia/interwiki.py 2009-01-23 14:58:03 UTC (rev 6287)
+++ trunk/pywikipedia/interwiki.py 2009-01-23 16:00:52 UTC (rev 6288)
@@ -1617,10 +1617,13 @@
hints.append(arg[6:])
elif arg.startswith('-hintfile:'):
hintfile = arg[10:]
- hintPageGen = pagegenerators.TextfilePageGenerator(hintfile)
- for page in hintPageGen:
- hints.append(page.title())
- del hintPageGen
+ if filename is None:
+ filename = wikipedia.input(u'Please enter the hint filename:')
+ f = codecs.open(filename, '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)
+ f.close()
elif arg == '-force':
globalvar.force = True
elif arg == '-same':
More information about the Pywikipedia-l
mailing list