Revision: 4367 Author: russblau Date: 2007-09-26 14:24:29 +0000 (Wed, 26 Sep 2007)
Log Message: ----------- bugfix to allow replaceCategoryInPlace to handle category titles that include (parentheses)
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-09-26 13:46:53 UTC (rev 4366) +++ trunk/pywikipedia/wikipedia.py 2007-09-26 14:24:29 UTC (rev 4367) @@ -2943,8 +2943,9 @@ # title might not be formatted correctly on the wiki if title[0].isalpha() and not site.nocapitalize: title = "[%s%s]" % (title[0].upper(), title[0].lower()) + title[1:] + title = title.replace(" ", "[ _]+").replace("(", r"(").replace(")", r")") categoryR = re.compile(r'[[\s*(%s)\s*:\s*%s\s*((?:|[^]]+)?]])' - % (catNamespace, title.replace(' ','[ _]+'))) + % (catNamespace, title)) if newcat is None: text = replaceExcept(oldtext, categoryR, '', ['nowiki', 'comment', 'math', 'pre']) else: