Revision: 6300 Author: siebrand Date: 2009-01-27 09:15:47 +0000 (Tue, 27 Jan 2009)
Log Message: ----------- [ 2358060 ] watchlist.py: fix regexp for Watchlists to support both old and new MonoBook formatting. Contributed by whym.
Modified Paths: -------------- trunk/pywikipedia/watchlist.py
Modified: trunk/pywikipedia/watchlist.py =================================================================== --- trunk/pywikipedia/watchlist.py 2009-01-27 09:07:55 UTC (rev 6299) +++ trunk/pywikipedia/watchlist.py 2009-01-27 09:15:47 UTC (rev 6300) @@ -66,10 +66,11 @@
print 'Parsing watchlist' watchlist = [] - itemR = re.compile(r'<li><input type="checkbox" name="id\[\]" value="(.+?)" />') - for m in itemR.finditer(watchlistHTML): - pageName = m.group(1) - watchlist.append(pageName) + for itemR in [re.compile(r'<li><input type="checkbox" name="id\[\]" value="(.+?)" />'), re.compile(r'<li><input name="titles\[\]" type="checkbox" value="(.+?)" />')]: + for m in itemR.finditer(watchlistHTML): + pageName = m.group(1) + watchlist.append(pageName) + # Save the watchlist to disk # The file is stored in the watchlists subdir. Create if necessary. f = open(wikipedia.config.datafilepath('watchlists',