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: [#6464] Fixed over-escaping of HTML entities in GC tracker importer
Date Mon, 19 Aug 2013 17:46:00 GMT
[#6464] Fixed over-escaping of HTML entities in GC tracker importer

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/7131637c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/7131637c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/7131637c

Branch: refs/heads/cj/6464
Commit: 7131637c5a99f2fa895a9da541a608030a55e9e6
Parents: cdb9cdc
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Mon Aug 19 17:45:39 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Mon Aug 19 17:45:39 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/__init__.py            | 2 +-
 ForgeImporters/forgeimporters/google/tracker.py             | 2 +-
 .../forgeimporters/tests/data/google/test-issue.html        | 2 ++
 .../forgeimporters/tests/google/functional/test_tracker.py  | 9 +++++++--
 .../forgeimporters/tests/google/test_extractor.py           | 5 ++++-
 5 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7131637c/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 1d570ea..bf9d5f0 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -285,7 +285,7 @@ class Comment(object):
                 u'{updates}'
             ).format(
                 author=self.author,
-                body=h.plain2markdown(self.body, preserve_multiple_spaces=True),
+                body=h.plain2markdown(self.body, preserve_multiple_spaces=True, has_html_entities=True),
                 updates='\n'.join(
                         '**%s** %s' % (k,v)
                         for k,v in self.updates.items()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7131637c/ForgeImporters/forgeimporters/google/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tracker.py b/ForgeImporters/forgeimporters/google/tracker.py
index 1b888d9..9f99348 100644
--- a/ForgeImporters/forgeimporters/google/tracker.py
+++ b/ForgeImporters/forgeimporters/google/tracker.py
@@ -97,7 +97,7 @@ class GoogleCodeTrackerImporter(ToolImporter):
                 u'{body}').format(
                     creator=issue.get_issue_creator(),
                     owner=owner_line,
-                    body=h.plain2markdown(issue.get_issue_description(), preserve_multiple_spaces=True),
+                    body=h.plain2markdown(issue.get_issue_description(), preserve_multiple_spaces=True,
has_html_entities=True),
                 )
         ticket.add_multiple_attachments(issue.get_issue_attachments())
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7131637c/ForgeImporters/forgeimporters/tests/data/google/test-issue.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/data/google/test-issue.html b/ForgeImporters/forgeimporters/tests/data/google/test-issue.html
index dbef54e..6373356 100644
--- a/ForgeImporters/forgeimporters/tests/data/google/test-issue.html
+++ b/ForgeImporters/forgeimporters/tests/data/google/test-issue.html
@@ -277,6 +277,8 @@ Test *Issue* for testing
 
     p = source.test_issue.post()
     p.count = p.count *5 #* 6
+    if p.count &gt; 5:
+        print "Not &lt; 5 &amp; != 5"
 
 That's all
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7131637c/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py b/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
index 52eb50f..5d991d7 100644
--- a/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
@@ -25,6 +25,7 @@ import mock
 from ming.orm import ThreadLocalORMSession
 from pylons import tmpl_context as c
 from IPython.testing.decorators import module_not_available, skipif
+from datadiff.tools import assert_equal
 
 from alluratest.controller import setup_basic_test
 from allura.tests.decorators import without_module
@@ -82,7 +83,7 @@ class TestGCTrackerImporter(TestCase):
         self.assertEqual(ticket.reported_by, anon)
         self.assertIsNone(ticket.assigned_to_id)
         self.assertEqual(ticket.summary, 'Test Issue')
-        self.assertEqual(ticket.description,
+        assert_equal(ticket.description,
                 '*Originally created by:* [john...@gmail.com](http://code.google.com/u/101557263855536553789/)\n'
                 '*Originally owned by:* [john...@gmail.com](http://code.google.com/u/101557263855536553789/)\n'
                 '\n'
@@ -100,6 +101,8 @@ class TestGCTrackerImporter(TestCase):
                 '\n'
                 '&nbsp;&nbsp;&nbsp; p = source\\.test\\_issue\\.post\\(\\)\n'
                 '&nbsp;&nbsp;&nbsp; p\\.count = p\\.count \\*5 \\#\\* 6\n'
+                '&nbsp;&nbsp;&nbsp; if p\\.count &gt; 5:\n'
+                '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print
"Not &lt; 5 &amp; \\!= 5"\n'
                 '\n'
                 'That\'s all'
             )
@@ -119,7 +122,7 @@ class TestGCTrackerImporter(TestCase):
     @skipif(module_not_available('html2text'))
     def test_html2text_escaping(self):
         ticket = self._make_ticket(self.test_issue)
-        self.assertEqual(ticket.description,
+        assert_equal(ticket.description,
                 '*Originally created by:* [john...@gmail.com](http://code.google.com/u/101557263855536553789/)\n'
                 '*Originally owned by:* [john...@gmail.com](http://code.google.com/u/101557263855536553789/)\n'
                 '\n'
@@ -137,6 +140,8 @@ class TestGCTrackerImporter(TestCase):
                 '\n'
                 '&nbsp;&nbsp;&nbsp; p = source.test\\_issue.post\\(\\)\n'
                 '&nbsp;&nbsp;&nbsp; p.count = p.count \\*5 \\#\\* 6\n'
+                '&nbsp;&nbsp;&nbsp; if p.count &gt; 5:\n'
+                '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print
"Not &lt; 5 &amp; \\!= 5"\n'
                 '\n'
                 'That\'s all'
             )

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7131637c/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 e196037..f212575 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_extractor.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
@@ -19,6 +19,7 @@ from unittest import TestCase
 import pkg_resources
 
 import mock
+from datadiff.tools import assert_equal
 
 from forgeimporters import google
 from forgeimporters import base
@@ -157,7 +158,7 @@ class TestGoogleCodeProjectExtractor(TestCase):
         self.assertEqual(gpe.get_issue_owner().url, 'http://code.google.com/u/101557263855536553789/')
         self.assertEqual(gpe.get_issue_status(), 'Started')
         self.assertEqual(gpe.get_issue_summary(), 'Test Issue')
-        self.assertEqual(gpe.get_issue_description(),
+        assert_equal(gpe.get_issue_description(),
                 'Test *Issue* for testing\n'
                 '\n'
                 '  1. Test List\n'
@@ -172,6 +173,8 @@ class TestGoogleCodeProjectExtractor(TestCase):
                 '\n'
                 '    p = source.test_issue.post()\n'
                 '    p.count = p.count *5 #* 6\n'
+                '    if p.count &gt; 5:\n'
+                '        print "Not &lt; 5 &amp; != 5"\n'
                 '\n'
                 'That\'s all'
             )


Mime
View raw message