http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9920
Revision: 9920
Author: binbot
Date: 2012-02-21 14:35:09 +0000 (Tue, 21 Feb 2012)
Log Message:
-----------
Enable tricky titles in exceptions + bugfix
Modified Paths:
--------------
trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/replace.py
===================================================================
--- trunk/pywikipedia/replace.py 2012-02-21 11:53:15 UTC (rev 9919)
+++ trunk/pywikipedia/replace.py 2012-02-21 14:35:09 UTC (rev 9920)
@@ -505,7 +505,8 @@
if choice == 'a':
self.acceptall = True
if choice == 'x': #May happen only if self.exctitles isn't
None
- self.exctitles.write(u"u'%s',\n" % page.title())
+ self.exctitles.write(
+ u"u'%s$',\n" % re.escape(page.title()))
self.exctitles.flush()
self.exceptcounter += 1
if choice == 'y':
@@ -912,9 +913,10 @@
try:
bot.run()
finally:
+ # Just for the spirit of programming (they were flushed)
if titlefile:
- # Just for the spirit of programming (they were flushed)
titlefile.close()
+ if excoutfile:
excoutfile.close()