duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #01274
[Merge] lp:~mterry/duplicity/utf8-po into lp:duplicity
Michael Terry has proposed merging lp:~mterry/duplicity/utf8-po into lp:duplicity.
Requested reviews:
duplicity-team (duplicity-team)
Related bugs:
Bug #989496 in Duplicity: "UnicodeDecodeError during backup"
https://bugs.launchpad.net/duplicity/+bug/989496
For more details, see:
https://code.launchpad.net/~mterry/duplicity/utf8-po/+merge/124209
For some crazy reason, the gettext module defaults to giving you strings in whatever charset the po file happened to define. Which means you never know what string of bytes you're going to get.
This module makes sure we always get utf-8 byte strings. So we're at least predictable and reduces one source of UnicodeDecodeErrors (like in bug 989496)
--
https://code.launchpad.net/~mterry/duplicity/utf8-po/+merge/124209
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/utf8-po into lp:duplicity.
=== modified file 'bin/duplicity'
--- bin/duplicity 2012-02-29 13:35:03 +0000
+++ bin/duplicity 2012-09-13 14:12:28 +0000
@@ -35,7 +35,7 @@
sys.path.insert(0, os.path.abspath(os.path.join(pwd, "../.")))
import gettext
-gettext.install('duplicity')
+gettext.install('duplicity', codeset='utf8')
from duplicity import log
log.setup()
=== modified file 'bin/rdiffdir'
--- bin/rdiffdir 2011-11-07 15:08:24 +0000
+++ bin/rdiffdir 2012-09-13 14:12:28 +0000
@@ -28,7 +28,7 @@
import sys, getopt, gzip, os
import gettext
-gettext.install('duplicity')
+gettext.install('duplicity', codeset='utf8')
from duplicity import diffdir
from duplicity import patchdir
=== modified file 'duplicity/__init__.py'
--- duplicity/__init__.py 2009-04-21 17:21:06 +0000
+++ duplicity/__init__.py 2012-09-13 14:12:28 +0000
@@ -20,4 +20,4 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import gettext
-gettext.install('duplicity')
+gettext.install('duplicity', codeset='utf8')
=== modified file 'testing/manual/config.py.tmpl'
--- testing/manual/config.py.tmpl 2011-11-17 15:59:54 +0000
+++ testing/manual/config.py.tmpl 2012-09-13 14:12:28 +0000
@@ -25,7 +25,7 @@
sys.path.insert(0, newpath)
import gettext
-gettext.install('duplicity')
+gettext.install('duplicity', codeset='utf8')
from duplicity import globals
from duplicity import log
=== added file 'testing/tests/unicode.py'
--- testing/tests/unicode.py 1970-01-01 00:00:00 +0000
+++ testing/tests/unicode.py 2012-09-13 14:12:28 +0000
@@ -0,0 +1,39 @@
+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
+#
+# Copyright 2012 Canonical Ltd
+#
+# This file is part of duplicity.
+#
+# Duplicity is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# Duplicity is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with duplicity; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import sys
+import unittest
+from mock import patch
+
+
+class UTF8Test(unittest.TestCase):
+
+ def setUp(self):
+ if 'duplicity' in sys.modules:
+ del(sys.modules["duplicity"])
+
+ @patch('gettext.install')
+ def test_module_install(self, inst_mock):
+ """Make sure we convert po files to utf8"""
+ import duplicity
+ inst_mock.assert_called_once_with('duplicity', codeset='utf8')
+
+if __name__ == "__main__":
+ unittest.main()
Follow ups