Revision: 5337 Author: wikipedian Date: 2008-05-08 19:03:33 +0000 (Thu, 08 May 2008)
Log Message: ----------- bugfix: the script crashed on wikis that don't have any references templates (e. g. de:)
Modified Paths: -------------- trunk/pywikipedia/noreferences.py
Modified: trunk/pywikipedia/noreferences.py =================================================================== --- trunk/pywikipedia/noreferences.py 2008-05-08 19:03:30 UTC (rev 5336) +++ trunk/pywikipedia/noreferences.py 2008-05-08 19:03:33 UTC (rev 5337) @@ -237,16 +237,17 @@ wikipedia.output(u'No changes necessary: references tag found.') return False else: - templateR ='' - part = '{{(' - for template in self.referencesTemplates: - templateR += part + template - part = '|' - templateR+=')' - if re.search(templateR,oldTextCleaned,re.I): - if verbose: - wikipedia.output(u'No changes necessary: references template found.') - return False + if self.referencesTemplates: + templateR ='' + part = '{{(' + for template in self.referencesTemplates: + templateR += part + template + part = '|' + templateR+=')' + if re.search(templateR, oldTextCleaned, re.IGNORECASE): + if verbose: + wikipedia.output(u'No changes necessary: references template found.') + return False if verbose: wikipedia.output(u'Found ref without references.') return True