http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10480
Revision: 10480 Author: xqt Date: 2012-08-09 18:57:30 +0000 (Thu, 09 Aug 2012) Log Message: ----------- Return list of compareLanguages() has been changed in r6943; Follow-up fix for bug tracker on my tp [1] Also dedent if statement which is always true.
[1] http://de.wikipedia.org/w/index.php?title=Benutzer_Diskussion%3AXqt&diff...
Modified Paths: -------------- trunk/pywikipedia/warnfile.py
Modified: trunk/pywikipedia/warnfile.py =================================================================== --- trunk/pywikipedia/warnfile.py 2012-08-09 17:40:53 UTC (rev 10479) +++ trunk/pywikipedia/warnfile.py 2012-08-09 18:57:30 UTC (rev 10480) @@ -13,7 +13,7 @@ """ # # (C) Rob W.W. Hooft, 2003 -# (C) Pywikipedia bot team, 2003-2010 +# (C) Pywikipedia bot team, 2003-2012 # # Distributed under the terms of the MIT license. # @@ -64,6 +64,7 @@ f.close() return hints, removeHints
+ class WarnfileRobot: def __init__(self, warnfileReader): self.warnfileReader = warnfileReader @@ -99,32 +100,34 @@ del new[site] except KeyError: pass - mods, adding, removing, modifying = interwiki.compareLanguages(old, + mods, mcomment, adding, removing, modifying = interwiki.compareLanguages(old, new, insite=page.site()) if mods: pywikibot.output(page.title(asLink=True) + mods) oldtext = page.get() newtext = pywikibot.replaceLanguageLinks(oldtext, new) - if 1: - pywikibot.showDiff(oldtext, newtext) - try: - status, reason, data = page.put(newtext, - comment='warnfile '+mods) - except pywikibot.LockedPage: - pywikibot.output(u"Page is locked. Skipping.") - continue - except pywikibot.SpamfilterError, e: - pywikibot.output( - u'Cannot change %s because of blacklist entry %s' - % (page.title(), e.url)) - continue - except pywikibot.Error: - pywikibot.output(u"Error while saving page.") - continue - if str(status) != '302': - print status, reason
+ pywikibot.showDiff(oldtext, newtext) + try: + #TODO: special warnfile comment needed like in previous releases? + status, reason, data = page.put(newtext, + comment=mcomment) + except pywikibot.LockedPage: + pywikibot.output(u"Page is locked. Skipping.") + continue + except pywikibot.SpamfilterError, e: + pywikibot.output( + u'Cannot change %s because of blacklist entry %s' + % (page.title(), e.url)) + continue + except pywikibot.Error: + pywikibot.output(u"Error while saving page.") + continue + if str(status) != '302': + print status, reason + + def main(): filename = None for arg in pywikibot.handleArgs():