From: Aarni Koskela Date: Thu, 14 Apr 2016 08:41:27 +0000 (+0300) Subject: frontend: don't use unicode-variant %r for logging X-Git-Tag: v2.4.0~28^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72e97c1734e8bf7b6ff7d8c4c010f895a25034ed;p=thirdparty%2Fbabel.git frontend: don't use unicode-variant %r for logging Now that arguments are more likely to be unicode than bytestrings, %r is not a good idea between Python versions. --- diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py index b975ff38..76cf1718 100644 --- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -222,12 +222,12 @@ class compile_catalog(Command): if len(catalog): percentage = translated * 100 // len(catalog) self.log.info( - '%d of %d messages (%d%%) translated in %r', + '%d of %d messages (%d%%) translated in %s', translated, len(catalog), percentage, po_file ) if catalog.fuzzy and not self.use_fuzzy: - self.log.info('catalog %r is marked as fuzzy, skipping', po_file) + self.log.info('catalog %s is marked as fuzzy, skipping', po_file) continue for message, errors in catalog.check(): @@ -236,7 +236,7 @@ class compile_catalog(Command): 'error: %s:%d: %s', po_file, message.lineno, error ) - self.log.info('compiling catalog %r to %r', po_file, mo_file) + self.log.info('compiling catalog %s to %s', po_file, mo_file) outfile = open(mo_file, 'wb') try: @@ -574,7 +574,7 @@ class init_catalog(Command): def run(self): self.log.info( - 'creating catalog %r based on %r', self.output_file, self.input_file + 'creating catalog %s based on %s', self.output_file, self.input_file ) infile = open(self.input_file, 'rb') @@ -705,7 +705,7 @@ class update_catalog(Command): raise DistutilsOptionError('no message catalogs found') for locale, filename in po_files: - self.log.info('updating catalog %r based on %r', filename, self.input_file) + self.log.info('updating catalog %s based on %s', filename, self.input_file) infile = open(filename, 'rb') try: catalog = read_po(infile, locale=locale, domain=domain) diff --git a/tests/messages/test_frontend.py b/tests/messages/test_frontend.py index 118d3f29..ad938ace 100644 --- a/tests/messages/test_frontend.py +++ b/tests/messages/test_frontend.py @@ -1092,7 +1092,7 @@ msgstr[2] "" '-d', self._i18n_dir()]) assert not os.path.isfile(mo_file), 'Expected no file at %r' % mo_file self.assertEqual("""\ -catalog %r is marked as fuzzy, skipping +catalog %s is marked as fuzzy, skipping """ % (po_file), sys.stderr.getvalue()) def test_compile_fuzzy_catalog(self): @@ -1104,7 +1104,7 @@ catalog %r is marked as fuzzy, skipping '-d', self._i18n_dir()]) assert os.path.isfile(mo_file) self.assertEqual("""\ -compiling catalog %r to %r +compiling catalog %s to %s """ % (po_file, mo_file), sys.stderr.getvalue()) finally: if os.path.isfile(mo_file): @@ -1123,7 +1123,7 @@ compiling catalog %r to %r '-d', self._i18n_dir()]) assert os.path.isfile(mo_file) self.assertEqual("""\ -compiling catalog %r to %r +compiling catalog %s to %s """ % (po_file, mo_file), sys.stderr.getvalue()) finally: if os.path.isfile(mo_file): @@ -1143,8 +1143,8 @@ compiling catalog %r to %r for mo_file in [mo_foo, mo_bar]: assert os.path.isfile(mo_file) self.assertEqual("""\ -compiling catalog %r to %r -compiling catalog %r to %r +compiling catalog %s to %s +compiling catalog %s to %s """ % (po_foo, mo_foo, po_bar, mo_bar), sys.stderr.getvalue()) finally: