incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [2/2] git commit: [#7022] ticket:519 UnicodeDecodeError on side-by-side diff text
Date Thu, 23 Jan 2014 22:05:40 GMT
[#7022] ticket:519 UnicodeDecodeError on side-by-side diff text


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/bc4c5649
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/bc4c5649
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/bc4c5649

Branch: refs/heads/master
Commit: bc4c5649e6d91f0fdb24dbc9fce9a5d497919c8e
Parents: 6eefcd3
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Sun Jan 19 23:33:23 2014 +0400
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Thu Jan 23 22:05:35 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/diff.py        | 3 ++-
 Allura/allura/tests/test_diff.py | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bc4c5649/Allura/allura/lib/diff.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/diff.py b/Allura/allura/lib/diff.py
index d595fe3..bdeb76d 100644
--- a/Allura/allura/lib/diff.py
+++ b/Allura/allura/lib/diff.py
@@ -16,6 +16,7 @@
 #       under the License.
 
 import difflib
+from allura.lib import helpers as h
 
 
 class HtmlSideBySideDiff(object):
@@ -112,4 +113,4 @@ class HtmlSideBySideDiff(object):
         bdesc = bdesc or ''
         diff = difflib._mdiff(a, b, context=context)
         lines = [self._make_line(d) for d in diff]
-        return self.table_tmpl % (adesc, bdesc, '\n'.join(lines))
+        return h.really_unicode(self.table_tmpl % (adesc, bdesc, '\n'.join(lines)))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bc4c5649/Allura/allura/tests/test_diff.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_diff.py b/Allura/allura/tests/test_diff.py
index 20f1859..67c0807 100644
--- a/Allura/allura/tests/test_diff.py
+++ b/Allura/allura/tests/test_diff.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #       Licensed to the Apache Software Foundation (ASF) under one
 #       or more contributor license agreements.  See the NOTICE file
 #       distributed with this work for additional information
@@ -137,3 +138,9 @@ class TestHtmlSideBySideDiff(unittest.TestCase):
 '''.strip()
         html = self.diff.make_table(a, b, 'file a', 'file b')
         self.assertEquals(html, expected)
+
+    def test_unicode_make_table(self):
+        a = ['строка']
+        b = ['измененная строка']
+        html = self.diff.make_table(a, b, 'file a', 'file b')
+        assert u'строка' in html


Mime
View raw message