http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10970
Revision: 10970 Author: xqt Date: 2013-01-23 14:26:23 +0000 (Wed, 23 Jan 2013) Log Message: ----------- smarter code
Modified Paths: -------------- trunk/pywikipedia/checkimages.py
Modified: trunk/pywikipedia/checkimages.py =================================================================== --- trunk/pywikipedia/checkimages.py 2013-01-23 12:55:29 UTC (rev 10969) +++ trunk/pywikipedia/checkimages.py 2013-01-23 14:26:23 UTC (rev 10970) @@ -636,30 +636,17 @@ self.commImage = commImage or self.comment
while True: - if unver: - try: - resPutMex = self.tag_image() - except pywikibot.NoPage: - pywikibot.output(u"The page has been deleted! Skip!") - break - except pywikibot.EditConflict: - pywikibot.output(u"Edit conflict! Skip!") - break - else: - if not resPutMex: - break + try: + resPutMex = self.tag_image(univer) + except pywikibot.NoPage: + pywikibot.output(u"The page has been deleted! Skip!") + break + except pywikibot.EditConflict: + pywikibot.output(u"Edit conflict! Skip!") + break else: - try: - resPutMex = self.tag_image(False) - except pywikibot.NoPage: - pywikibot.output(u"The page has been deleted!") + if not resPutMex: break - except pywikibot.EditConflict: - pywikibot.output(u"Edit conflict! Skip!") - break - else: - if not resPutMex: - break if self.notification: try: self.put_mex_in_talk() @@ -687,7 +674,7 @@ else: return upBotArray[0] # we can't find the user, report the problem to the bot
- def tag_image(self, put = True): + def tag_image(self, put=True): """ Function to add the template in the image and to find out who's the user that has uploaded the file.
pywikipedia-svn@lists.wikimedia.org