Revision: 5181 Author: cosoleto Date: 2008-04-05 14:04:24 +0000 (Sat, 05 Apr 2008)
Log Message: ----------- Undo 5180 (code cleanup, bug #1932907 already fixed) and minor fix adding the count parameter in 'replace'. The RE compilation error it's due to group name strings, not to '' or '' that previous commit want remove before to call compile(). Please, use the tracker.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-04-05 12:41:38 UTC (rev 5180) +++ trunk/pywikipedia/wikipedia.py 2008-04-05 14:04:24 UTC (rev 5181) @@ -1360,12 +1360,11 @@ retry_delay = 30 continue if self.site().has_mediawiki_message('longpageerror'): - longpage = html2unicode(self.site().mediawiki_message('longpageerror')) - longpage = longpage.replace(" $1", "(?P<length>[\d,. ]+)", 1).replace(" $2", "(?P<limit>[\d,. ]+)", 1) - # some messages might display several times $1 or $2 - # (bug #1932907). - longpage = re.sub('$[12]', '.*', longpage) - long_page_errorR = re.compile(longpage) + long_page_errorR = re.compile( + html2unicode( + self.site().mediawiki_message('longpageerror') + ).replace(" $1", "(?P<length>[\d,. ]+)", 1).replace(" $2", "(?P<limit>[\d,. ]+)", 1) + ) match = long_page_errorR.search(data) if match: raise LongPageError(match.group('length'), match.group('limit'))
pywikipedia-l@lists.wikimedia.org