http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11478
Revision: 11478 Author: drtrigon Date: 2013-04-28 12:17:07 +0000 (Sun, 28 Apr 2013) Log Message: ----------- follow-up; to r10930 in order to make str to unicode improvement; adoption to new output/logging
Modified Paths: -------------- trunk/pywikipedia/clean_sandbox.py trunk/pywikipedia/pywikibot/comms/http.py
Modified: trunk/pywikipedia/clean_sandbox.py =================================================================== --- trunk/pywikipedia/clean_sandbox.py 2013-04-28 12:08:31 UTC (rev 11477) +++ trunk/pywikipedia/clean_sandbox.py 2013-04-28 12:17:07 UTC (rev 11478) @@ -200,7 +200,7 @@ else: diff = minutesDiff(sandboxPage.editTime(), time.strftime("%Y%m%d%H%M%S", time.gmtime())) if pywikibot.verbose: - pywikibot.output(str((sandboxPage.editTime(), time.strftime("%Y%m%d%H%M%S", time.gmtime())))) + pywikibot.output(unicode((sandboxPage.editTime(), time.strftime("%Y%m%d%H%M%S", time.gmtime())))) #Is the last edit more than 5 minutes ago? if diff >= self.delay: sandboxPage.put(translatedContent, translatedMsg)
Modified: trunk/pywikipedia/pywikibot/comms/http.py =================================================================== --- trunk/pywikipedia/pywikibot/comms/http.py 2013-04-28 12:08:31 UTC (rev 11477) +++ trunk/pywikipedia/pywikibot/comms/http.py 2013-04-28 12:17:07 UTC (rev 11478) @@ -158,8 +158,8 @@ else: pywikibot.output(u"Result: %s %s" % (e.code, e.msg)) raise - except Exception, e: - pywikibot.output(u'%s' %e) + except: + pywikibot.exception() if retry: retry_attempt += 1 if retry_attempt > config.maxretries: @@ -219,9 +219,9 @@ # Check if this is the charset we expected try: site.checkCharset(charset) - except AssertionError, e: + except AssertionError: if (not back_response) or verbose: - pywikibot.output(u'%s' %e) + pywikibot.exception() if no_hostname: pywikibot.error(u'Invalid charset found on %s.' % uri) else: @@ -230,9 +230,9 @@ # Convert HTML to Unicode try: text = unicode(text, charset, errors = 'strict') - except UnicodeDecodeError, e: + except UnicodeDecodeError: if (not back_response) or verbose: - pywikibot.output(u'%s' %e) + pywikibot.exception() if no_hostname: pywikibot.error(u'Invalid characters found on %s, ' u'replaced by \ufffd.' % uri)
pywikipedia-svn@lists.wikimedia.org