]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
frontend: don't use unicode-variant %r for logging
authorAarni Koskela <akx@iki.fi>
Thu, 14 Apr 2016 08:41:27 +0000 (11:41 +0300)
committerAarni Koskela <akx@iki.fi>
Tue, 19 Apr 2016 18:29:08 +0000 (21:29 +0300)
Now that arguments are more likely to be unicode than bytestrings, %r is not a good idea between Python versions.

babel/messages/frontend.py
tests/messages/test_frontend.py

index b975ff38b40ee0f67c560ae49c859ee5a7541cfd..76cf1718d8d8d12520500fb4367b2b5630c28e1e 100644 (file)
@@ -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)
index 118d3f29b8cf0227d1dc14085b3305e0ed43c480..ad938ace8032795b55d76207c448fb24aab93d21 100644 (file)
@@ -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: