Revision: 8260 Author: xqt Date: 2010-06-09 07:15:01 +0000 (Wed, 09 Jun 2010)
Log Message: ----------- reduce screen and log file clogging (feature request bug 3013287)
Modified Paths: -------------- branches/rewrite/scripts/interwiki.py trunk/pywikipedia/interwiki.py
Modified: branches/rewrite/scripts/interwiki.py =================================================================== --- branches/rewrite/scripts/interwiki.py 2010-06-09 06:28:37 UTC (rev 8259) +++ branches/rewrite/scripts/interwiki.py 2010-06-09 07:15:01 UTC (rev 8260) @@ -1089,7 +1089,11 @@ return False if globalvar.nobackonly: if page == self.originPage: - pywikibot.output(u"%s has a backlink from %s."%(page,linkingPage)) + try: + pywikibot.output(u"%s has a backlink from %s." + % (page, linkingPage)) + except UnicodeDecodeError: + pywikibot.output(u"Found a backlink for a page.") self.makeForcedStop(counter) return False
@@ -1738,9 +1742,6 @@ pywikibot.output(u"Not editing %s: page does not exist" % page) raise SaveError(u'Page doesn't exist')
- # Show a message in purple. - pywikibot.output(u"\03{lightpurple}Updating links on page %s.\03{default}" % page) - # clone original newPages dictionary, so that we can modify it to the local page's needs new = dict(newPages)
@@ -1755,7 +1756,6 @@
try: if (new[ignorepage.site] == ignorepage) and (ignorepage.site != page.site): - if (ignorepage not in interwikis): pywikibot.output(u"Ignoring link to %(to)s for %(from)s" % {'to': ignorepage, 'from': page}) new.pop(ignorepage.site) @@ -1794,9 +1794,15 @@ mods, mcomment, adding, removing, modifying = compareLanguages(old, new, insite = page.site)
if not mods: - pywikibot.output(u'No changes needed' ) + if not globalvar.quiet: + pywikibot.output(u'No changes needed on page %s' + % page.title(asLink=True, + forceInterwiki=True)) return False
+ # Show a message in purple. + pywikibot.output(u"\03{lightpurple}Updating links on page %s.\03{default}" % page) + pywikibot.output(u"Changes to be made: %s" % mods) oldtext = page.get() template = (page.namespace() == 10)
Modified: trunk/pywikipedia/interwiki.py =================================================================== --- trunk/pywikipedia/interwiki.py 2010-06-09 06:28:37 UTC (rev 8259) +++ trunk/pywikipedia/interwiki.py 2010-06-09 07:15:01 UTC (rev 8260) @@ -1063,7 +1063,8 @@ if globalvar.nobackonly: if page == self.originPage: try: - pywikibot.output(u"%s has a backlink from %s."%(page,linkingPage)) + pywikibot.output(u"%s has a backlink from %s." + % (page, linkingPage)) except UnicodeDecodeError: pywikibot.output(u"Found a backlink for a page.") self.makeForcedStop(counter) @@ -1712,9 +1713,6 @@ pywikibot.output(u"Not editing %s: page does not exist" % page.aslink(True)) raise SaveError
- # Show a message in purple. - pywikibot.output(u"\03{lightpurple}Updating links on page %s.\03{default}" % page.aslink(True)) - # clone original newPages dictionary, so that we can modify it to the local page's needs new = dict(newPages)
@@ -1729,7 +1727,6 @@
try: if (new[ignorepage.site()] == ignorepage) and (ignorepage.site() != page.site()): - if (ignorepage not in interwikis): pywikibot.output(u"Ignoring link to %(to)s for %(from)s" % {'to': ignorepage.aslink(), 'from': page.aslink()}) new.pop(ignorepage.site()) @@ -1768,9 +1765,14 @@ mods, mcomment, adding, removing, modifying = compareLanguages(old, new, insite = page.site())
if not mods: - pywikibot.output(u'No changes needed' ) + if not globalvar.quiet or pywikibot.verbose: + pywikibot.output(u'No changes needed on page %s' + % page.aslink(True)) return False
+ # Show a message in purple. + pywikibot.output(u"\03{lightpurple}Updating links on page %s.\03{default}" % page.aslink(True)) + pywikibot.output(u"Changes to be made: %s" % mods) oldtext = page.get() template = (page.namespace() == 10)