[Pywikipedia-l] SVN: [5952] trunk/pywikipedia/checkimages.py

filnik at svn.wikimedia.org filnik at svn.wikimedia.org
Fri Oct 10 16:47:17 UTC 2008


Revision: 5952
Author:   filnik
Date:     2008-10-10 16:47:17 +0000 (Fri, 10 Oct 2008)

Log Message:
-----------
Little fix in the checkImageOnCommons() function, add 'same name' if the images have.. the same name, yes, how do you guess? :) 

Modified Paths:
--------------
    trunk/pywikipedia/checkimages.py

Modified: trunk/pywikipedia/checkimages.py
===================================================================
--- trunk/pywikipedia/checkimages.py	2008-10-10 15:28:22 UTC (rev 5951)
+++ trunk/pywikipedia/checkimages.py	2008-10-10 16:47:17 UTC (rev 5952)
@@ -793,7 +793,7 @@
         """ Checking if the image is on commons """
         wikipedia.output(u'Checking if %s is on commons...' % self.image)
         commons_site = wikipedia.getSite('commons', 'commons')
-        regexOnCommons = r"\n\*\[\[:Image:%s\]\] is also on '''Commons''': \[\[commons:Image:.*?\]\]$" % self.image
+        regexOnCommons = r"\n\*\[\[:Image:%s\]\] is also on '''Commons''': \[\[commons:Image:.*?\]\](?: \(same name\)|)$" % self.image
         imagePage = wikipedia.ImagePage(self.site, 'Image:%s' % self.image)
         hash_found = imagePage.getHash()
         if hash_found == None:
@@ -809,11 +809,14 @@
                     # Problems? Yes! We have to skip the check part for that image!
                     # Because it's on commons but someone has added something on your project.
                     return False
-                elif 'stemma' in self.image.lower() and self.site.lang == 'it':
+                elif re.findall(r'\bstemma\b', self.image.lower()) != [] and self.site.lang == 'it':
                     wikipedia.output(u'%s has "stemma" inside, means that it\'s ok.' % self.image)
                     return True # Problems? No, it's only not on commons but the image needs a check
                 else:
-                    repme = "\n*[[:Image:%s]] is also on '''Commons''': [[commons:Image:%s]]" % (self.image, commons_image_with_this_hash[0])
+                    if self.image == commons_image_with_this_hash[0]:
+                        repme = "\n*[[:Image:%s]] is also on '''Commons''': [[commons:Image:%s]] (same name)" % (self.image, commons_image_with_this_hash[0])
+                    else:
+                        repme = "\n*[[:Image:%s]] is also on '''Commons''': [[commons:Image:%s]]" % (self.image, commons_image_with_this_hash[0])
                     self.report_image(self.image, self.rep_page, self.com, repme, addings = False, regex = regexOnCommons)
                     # Problems? No, return True
                     return True





More information about the Pywikipedia-l mailing list