Revision: 6509 Author: filnik Date: 2009-03-16 19:54:27 +0000 (Mon, 16 Mar 2009)
Log Message: ----------- Bugfix
Modified Paths: -------------- trunk/pywikipedia/checkimages.py
Modified: trunk/pywikipedia/checkimages.py =================================================================== --- trunk/pywikipedia/checkimages.py 2009-03-15 12:35:14 UTC (rev 6508) +++ trunk/pywikipedia/checkimages.py 2009-03-16 19:54:27 UTC (rev 6509) @@ -1056,6 +1056,7 @@ This function check this. """ if template in self.list_licenses: # the list_licenses are loaded in the __init__ (not to load them multimple times) + self.license_selected = template.title().replace('Template:', '') self.seems_ok = True self.license_found = self.license_selected # let the last "fake" license normally detected return True @@ -1076,7 +1077,6 @@ we can find something in the info that we already have, then make a deeper check. """ for template in self.licenses_found: - self.license_selected = template.title().replace('Template:', '') result = self.miniTemplateCheck(template) if result: break @@ -1086,12 +1086,11 @@ template.pageAPInfo() except wikipedia.IsRedirectPage: template = template.getRedirectTarget() + result = self.miniTemplateCheck(template) + if result: + break except wikipedia.NoPage: - continue - self.license_selected = template.title().replace('Template:', '') - result = self.miniTemplateCheck(template) - if result: - break + continue
def smartDetection(self): """ The bot instead of checking if there's a simple template in the @@ -1113,8 +1112,8 @@ # Found the templates ONLY in the image's description for template_selected in templatesInTheImageRaw: for templateReal in self.licenses_found: - if self.convert_to_url(template_selected).lower().replace('template:', '') == \ - self.convert_to_url(templateReal.title().replace('template:', '')).lower(): + if self.convert_to_url(template_selected).lower().replace('template%3a', '') == \ + self.convert_to_url(templateReal.title()).lower().replace('template%3a', ''): if templateReal not in self.allLicenses: # don't put the same template, twice. self.allLicenses.append(templateReal) if self.licenses_found != []: