jenkins-bot has submitted this change and it was merged. Change subject: Revert "[IMPROV] Reduce usage of unicode()" ......................................................................
Revert "[IMPROV] Reduce usage of unicode()" The change completely breaks: https://travis-ci.org/wikimedia/pywikibot-core/builds/43211148 This reverts commit 58fd995ac73efa1c7807c0315c8c2140eb22011b. Change-Id: I815faa4f75c2a473dfa444da9248607717e5288a --- M pywikibot/bot.py M pywikibot/pagegenerators.py M scripts/checkimages.py 3 files changed, 17 insertions(+), 7 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 99622dc..6e92dbf 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -266,7 +266,7 @@ log(u'=== Pywikibot framework v2.0 -- Logging header ===') # script call - log(u'COMMAND: %s' % sys.argv) + log(u'COMMAND: %s' % unicode(sys.argv)) # script call time stamp log(u'DATE: %s UTC' % str(datetime.datetime.utcnow())) @@ -280,7 +280,7 @@ # system if hasattr(os, 'uname'): - log(u'SYSTEM: %s' % os.uname()) + log(u'SYSTEM: %s' % unicode(os.uname())) # config file dir log(u'CONFIG FILE DIR: %s' % pywikibot.config2.base_dir) @@ -319,7 +319,7 @@ log(u' %s' % ver) if config.log_pywiki_repo_version: - log(u'PYWIKI REPO VERSION: %s' % version.getversion_onlinerepo()) + log(u'PYWIKI REPO VERSION: %s' % unicode(version.getversion_onlinerepo())) log(u'=== ' * 14) @@ -1074,7 +1074,7 @@ if site not in self._sites: log(u'LOADING SITE %s VERSION: %s' - % (site, site.version())) + % (site, unicode(site.version()))) self._sites.add(site) if len(self._sites) == 2: diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index 00e0f11..a4b5b43 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -40,6 +40,7 @@ if sys.version_info[0] > 2: basestring = (str, ) + unicode = str _logger = "pagegenerators" @@ -1965,7 +1966,7 @@ pywikibot.output(u'retrieved %d items' % data[u'status'][u'items']) for item in data[u'items']: - page = pywikibot.ItemPage(repo, u'Q{0}'.format(item)) + page = pywikibot.ItemPage(repo, u'Q' + unicode(item)) try: link = page.getSitelink(site) except pywikibot.NoPage: diff --git a/scripts/checkimages.py b/scripts/checkimages.py index 66b1aee..1310359 100644 --- a/scripts/checkimages.py +++ b/scripts/checkimages.py @@ -92,6 +92,7 @@ import re import time import datetime +import locale import sys import pywikibot @@ -101,6 +102,8 @@ if sys.version_info[0] > 2: basestring = (str, ) + +locale.setlocale(locale.LC_ALL, '') ############################################################################### # <--------------------------- Change only below! ---------------------------># @@ -569,8 +572,14 @@ def printWithTimeZone(message): """Print the messages followed by the TimeZone encoded correctly.""" if message[-1] != ' ': - message = u'%s ' % message - time_zone = time.strftime(u"%d %b %Y %H:%M:%S (UTC)", time.gmtime()) + message = '%s ' % unicode(message) + if locale.getlocale()[1]: + time_zone = unicode(time.strftime(u"%d %b %Y %H:%M:%S (UTC)", + time.gmtime()), + locale.getlocale()[1]) + else: + time_zone = unicode(time.strftime(u"%d %b %Y %H:%M:%S (UTC)", + time.gmtime())) pywikibot.output(u"%s%s" % (message, time_zone)) -- To view, visit https://gerrit.wikimedia.org/r/178005 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I815faa4f75c2a473dfa444da9248607717e5288a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Nullzero <nullzero.f...@gmail.com> Gerrit-Reviewer: John Vandenberg <jay...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl> Gerrit-Reviewer: Xqt <i...@gno.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits