Revision: 4056 Author: btongminh Date: 2007-08-17 09:05:32 +0000 (Fri, 17 Aug 2007)
Log Message: -----------
Modified Paths: -------------- trunk/pywikipedia/checkusage.py trunk/pywikipedia/delinker.py trunk/pywikipedia/image_replacer.py
Modified: trunk/pywikipedia/checkusage.py =================================================================== --- trunk/pywikipedia/checkusage.py 2007-08-16 21:21:43 UTC (rev 4055) +++ trunk/pywikipedia/checkusage.py 2007-08-17 09:05:32 UTC (rev 4056) @@ -336,6 +336,7 @@
def exists(self, site, image): + self.connect_http() # Check whether the image still is deleted on Commons. # BUG: This also returns true for images with a page, but # without the image itself. Can be fixed by querying query.php
Modified: trunk/pywikipedia/delinker.py =================================================================== --- trunk/pywikipedia/delinker.py 2007-08-16 21:21:43 UTC (rev 4055) +++ trunk/pywikipedia/delinker.py 2007-08-17 09:05:32 UTC (rev 4056) @@ -387,7 +387,10 @@ # without the image itself. Can be fixed by querying query.php # instead of api.php. Also should this be made as an exits() # method of checkusage.CheckUsage? - if self.CheckUsage.exists(self.site.shared_image_repository(), image) and not bool(replacement): + shared_image_repository = self.CommonsDelinker.get_site( + *self.site.shared_image_repository()) + if self.CheckUsage.exists(shared_image_repository, image) \ + and not bool(replacement): output(u'%s %s exists on the shared image repository!' % (self, image)) return if self.CheckUsage.exists(self.site.hostname(), image) and \
Modified: trunk/pywikipedia/image_replacer.py =================================================================== --- trunk/pywikipedia/image_replacer.py 2007-08-16 21:21:43 UTC (rev 4055) +++ trunk/pywikipedia/image_replacer.py 2007-08-17 09:05:32 UTC (rev 4056) @@ -14,7 +14,8 @@ import re, time import threadpool
-from delinker import wait_callback, output, connect_database, family +from delinker import wait_callback, output, connect_database +from checkusage import family
def mw_timestamp(ts): return '%s%s%s%s-%s%s-%s%sT%s%s:%s%s:%s%sZ' % tuple(ts) @@ -138,10 +139,13 @@ self.cursor.execute("""SELECT wiki, namespace, page_title FROM %s WHERE img = %%s AND status <> 'ok'""" % self.config['log_table'], (old_image, )) - not_ok = list(self.cursor) + not_ok = [(wiki, namespace, page_title.decode('utf-8', 'ignore')) + for wiki, namespace, page_title in self.cursor] - self.reporters.append((old_image, new_image, user, - comment, not_ok)) + self.reporters.append((old_image.decode('utf-8', 'ignore'), + new_image.decode('utf-8', 'ignore'), + user.decode('utf-8', 'ignore'), + comment.decode('utf-8', 'ignore'), not_ok)) def start(self):