Revision: 8814 Author: multichill Date: 2010-12-30 19:19:53 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Fix regular expression flags bug. Now the re.IGNORECASE should work.
Modified Paths: -------------- trunk/pywikipedia/imagecopy_self.py
Modified: trunk/pywikipedia/imagecopy_self.py =================================================================== --- trunk/pywikipedia/imagecopy_self.py 2010-12-29 22:27:03 UTC (rev 8813) +++ trunk/pywikipedia/imagecopy_self.py 2010-12-30 19:19:53 UTC (rev 8814) @@ -317,7 +317,7 @@ text = imagepage.get() foundMatch = False for (regex, replacement) in licenseTemplates: - match = re.search(regex, text, re.IGNORECASE) + match = re.search(regex, text, flags=re.IGNORECASE) if match: foundMatch = True if not foundMatch: @@ -428,10 +428,10 @@ #text = re.sub(u'{{(self|self2)|[^}]+}}', u'', text, re.IGNORECASE)
for toRemove in sourceGarbage: - text = re.sub(toRemove, u'', text, re.IGNORECASE) + text = re.sub(toRemove, u'', text, flags=re.IGNORECASE)
for (regex, repl) in licenseTemplates: - text = re.sub(regex, u'', text, re.IGNORECASE) + text = re.sub(regex, u'', text, flags=re.IGNORECASE)
text = pywikibot.removeCategoryLinks(text, imagepage.site()).strip()
@@ -506,9 +506,9 @@ result = u''
for (regex, replacement) in licenseTemplates: - match = re.search(regex, text, re.IGNORECASE) + match = re.search(regex, text, flags=re.IGNORECASE) if match: - result = re.sub(regex, replacement, match.group(0), re.IGNORECASE) + result = re.sub(regex, replacement, match.group(0), flags=re.IGNORECASE) return result % {u'author' : self.getAuthor(imagepage), u'lang' : lang, u'family' : family}