http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9803
Revision: 9803 Author: xqt Date: 2011-12-15 08:51:21 +0000 (Thu, 15 Dec 2011) Log Message: ----------- Page.section() maybe None; follow up for r9802
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2011-12-15 08:45:18 UTC (rev 9802) +++ trunk/pywikipedia/wikipedia.py 2011-12-15 08:51:21 UTC (rev 9803) @@ -696,9 +696,10 @@ self._expandcontents = contents else: self._contents = contents - hn = re.escape(self.section()) + hn = self.section() if hn: - m = re.search("=+[ ']*%s[ ']*=+" % hn, self._contents) + m = re.search("=+[ ']*%s[ ']*=+" % re.escape(hn), + self._contents) if verbose and not m: output(u"WARNING: Section does not exist: %s" % self) # Store any exceptions for later reference