Revision: 4875 Author: rotem Date: 2008-01-13 18:21:45 +0000 (Sun, 13 Jan 2008)
Log Message: ----------- (bug 1869983) Catch ServerError exceptions in Page.put.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-01-13 18:15:26 UTC (rev 4874) +++ trunk/pywikipedia/wikipedia.py 2008-01-13 18:21:45 UTC (rev 4875) @@ -1270,6 +1270,14 @@ response, data = self.site().postForm(address, predata, sysop) except httplib.BadStatusLine, line: raise PageNotSaved('Bad status line: %s' % line.line) + except ServerError: + output(u''.join(traceback.format_exception(*sys.exc_info()))) + output(u'Got a server error when putting; will retry in %i minutes.' % retry_delay) + time.sleep(60 * retry_delay) + retry_delay *= 2 + if retry_delay > 30: + retry_delay = 30 + continue if data != u'': # Saving unsuccessful. Possible reasons: # server lag, edit conflict or invalid edit token.