Revision: 6759 Author: nicdumz Date: 2009-04-30 04:41:00 +0000 (Thu, 30 Apr 2009)
Log Message: ----------- Raise InvalidTitle if the title starts by # (aka avoiding [[cu:#%%%$]])
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-04-30 01:51:08 UTC (rev 6758) +++ trunk/pywikipedia/wikipedia.py 2009-04-30 04:41:00 UTC (rev 6759) @@ -442,13 +442,15 @@ break
sectionStart = t.find(u'#') - if sectionStart >= 0: + if sectionStart > 0: self._section = t[sectionStart+1 : ].lstrip(" ") self._section = sectionencode(self._section, self.site().encoding()) if not self._section: self._section = None t = t[ : sectionStart].rstrip(" ") + elif sectionStart == 0: + raise InvalidTitle(u"Invalid title starting with a #: '%s'" % t) else: self._section = None