http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11058
Revision: 11058 Author: xqt Date: 2013-02-09 15:24:04 +0000 (Sat, 09 Feb 2013) Log Message: ----------- since we have -async option we don't need to make another get request while finishing a subject; update from rewrite r10660
Modified Paths: -------------- trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py =================================================================== --- trunk/pywikipedia/interwiki.py 2013-02-09 13:57:31 UTC (rev 11057) +++ trunk/pywikipedia/interwiki.py 2013-02-09 15:24:04 UTC (rev 11058) @@ -1552,14 +1552,11 @@ break return result
- def finish(self, bot=None): + def finish(self): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty.
- This contains a shortcut: if a subject list is given in the argument - bot, just before submitting a page change to the live wiki it is - checked whether we will have to wait. If that is the case, the bot will - be told to make another get request first.""" + """
#from clean_sandbox def minutesDiff(time1, time2): @@ -1620,7 +1617,7 @@ if not self.originPage.site.family.interwiki_forward: new[self.originPage.site] = self.originPage
- #self.replaceLinks(self.originPage, new, True, bot) + #self.replaceLinks(self.originPage, new, True)
updatedSites = [] notUpdatedSites = [] @@ -1639,7 +1636,7 @@ lclSiteDone = True # even if we fail the update if site.family.name in config.usernames and site.lang in config.usernames[site.family.name]: try: - if self.replaceLinks(new[site], new, bot): + if self.replaceLinks(new[site], new): updatedSites.append(site) if site != lclSite: frgnSiteDone = True @@ -1665,7 +1662,7 @@ (globalvar.needlimit and \ len(adding) + len(modifying) >= globalvar.needlimit +1): try: - if self.replaceLinks(new[site], new, bot): + if self.replaceLinks(new[site], new): updatedSites.append(site) except SaveError: notUpdatedSites.append(site) @@ -1730,7 +1727,7 @@ not site.has_transcluded_data: # Try to do the changes try: - if self.replaceLinks(page, new, bot): + if self.replaceLinks(page, new): # Page was changed updatedSites.append(site) except SaveError: @@ -1768,7 +1765,7 @@ if hasattr(page, '_contents'): del page._contents
- def replaceLinks(self, page, newPages, bot): + def replaceLinks(self, page, newPages): """ Returns True if saving was successful. """ @@ -1948,17 +1945,6 @@ answer = 'y' # If we got permission to submit, do so if answer == 'y': - # Check whether we will have to wait for pywikibot. If so, make - # another get-query first. - if bot: - while pywikibot.get_throttle.waittime() + 2.0 < pywikibot.put_throttle.waittime(): - if not globalvar.quiet or pywikibot.verbose: - pywikibot.output( - u"NOTE: Performing a recursive query first to save time....") - qdone = bot.oneQuery() - if not qdone: - # Nothing more to do - break if not globalvar.quiet or pywikibot.verbose: pywikibot.output(u"NOTE: Updating live wiki...") timeout=60 @@ -2284,7 +2270,7 @@ for i in xrange(len(self.subjects)-1, -1, -1): subj = self.subjects[i] if subj.isDone(): - subj.finish(self) + subj.finish() subj.clean() del self.subjects[i]