incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject git commit: [#6881] Fixed unicode decode error on GC import
Date Thu, 14 Nov 2013 20:57:39 GMT
Updated Branches:
  refs/heads/master 33e770a01 -> f3cdca998


[#6881] Fixed unicode decode error on GC import

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/master
Commit: f3cdca998ab1d76b55ecd61859a7035b469cc895
Parents: 33e770a
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Thu Nov 14 20:19:43 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Thu Nov 14 20:20:07 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/__init__.py         |  2 +-
 .../forgeimporters/tests/google/test_extractor.py        | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f3cdca99/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 60f96c3..c4b9a99 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -88,7 +88,7 @@ def _as_markdown(tag, project_name):
             fragment = '\n'
         else:
             # convert all others to plain MD
-            fragment = h.plain2markdown(str(fragment), preserve_multiple_spaces=True, has_html_entities=True)
+            fragment = h.plain2markdown(unicode(fragment), preserve_multiple_spaces=True,
has_html_entities=True)
         fragments.append(fragment)
     return ''.join(fragments).strip()
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f3cdca99/ForgeImporters/forgeimporters/tests/google/test_extractor.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/test_extractor.py b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
index b6be820..0752755 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_extractor.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
@@ -22,6 +22,7 @@ from urllib2 import HTTPError
 import mock
 from datadiff.tools import assert_equal
 from IPython.testing.decorators import skipif, module_not_available
+from BeautifulSoup import BeautifulSoup
 
 from allura.tests.decorators import without_module
 from forgeimporters import google
@@ -484,3 +485,13 @@ class TestComment(TestCase):
             u'Summary:': u'Make PyChess keyboard accessible',
             u'Status:': u'Accepted',
             })
+
+
+class TestAsMarkdown(TestCase):
+    def soup(self, tag):
+        return BeautifulSoup(u'<pre>%s</pre>' % tag).first()
+
+    def test_unicode(self):
+        tag = self.soup(u'\ua000 foo <a href="http://example.com/">bar</a>')
+        res = google._as_markdown(tag, 'pn')
+        self.assertEqual(res, u'\ua000 foo [bar](http://example.com/)')


Mime
View raw message