incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [15/44] git commit: [#6622] ticket:435 Convert markdown in tracker
Date Wed, 13 Nov 2013 22:57:35 GMT
[#6622] ticket:435 Convert markdown in tracker


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

Branch: refs/heads/cj/6815
Commit: 3cda147e048ce9519e3fba62e945242b79ec462f
Parents: 23db53a
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Mon Oct 14 17:03:07 2013 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Nov 13 17:16:56 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/github/tracker.py           | 10 ++++++++--
 .../forgeimporters/tests/github/test_tracker.py           |  6 +++++-
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3cda147e/ForgeImporters/forgeimporters/github/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tracker.py b/ForgeImporters/forgeimporters/github/tracker.py
index c3c7ab4..6dfa507 100644
--- a/ForgeImporters/forgeimporters/github/tracker.py
+++ b/ForgeImporters/forgeimporters/github/tracker.py
@@ -111,6 +111,12 @@ class GitHubTrackerImporter(ToolImporter):
                     'project_name': project_name,
                 }
             )
+        self.github_markdown_converter = GitHubMarkdownConverter(
+            kw['user_name'],
+            project_name,
+            project.shortname,
+            app.config.options.mount_point,
+        )
         ThreadLocalORMSession.flush_all()
         extractor = GitHubProjectExtractor(project_name)
         try:
@@ -170,7 +176,7 @@ class GitHubTrackerImporter(ToolImporter):
                 u'{body}').format(
                     creator=self.get_user_link(issue['user']['login']),
                     owner=owner_line,
-                    body=GitHubMarkdownConverter().convert(body),
+                    body=self.github_markdown_converter.convert(body),
                 )
         ticket.labels = [label['name'] for label in issue['labels']]
 
@@ -182,7 +188,7 @@ class GitHubTrackerImporter(ToolImporter):
                     self.get_user_link(comment['user']['login']))
                 body = posted_by + body
             p = ticket.discussion_thread.add_post(
-                    text = GitHubMarkdownConverter().convert(body),
+                    text = self.github_markdown_converter.convert(body),
                     ignore_security = True,
                     timestamp = self.parse_datetime(comment['created_at']),
                 )

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3cda147e/ForgeImporters/forgeimporters/tests/github/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/github/test_tracker.py b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
index 7cd3c90..6b8c736 100644
--- a/ForgeImporters/forgeimporters/tests/github/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
@@ -16,11 +16,11 @@
 #       under the License.
 
 from datetime import datetime
-from operator import itemgetter
 from unittest import TestCase
 import mock
 
 from ...github import tracker
+from forgeimporters.github.utils import GitHubMarkdownConverter
 
 
 class TestTrackerImporter(TestCase):
@@ -79,6 +79,7 @@ class TestTrackerImporter(TestCase):
             'labels': [{'name': 'first'}, {'name': 'second'}],
         }
         importer = tracker.GitHubTrackerImporter()
+        importer.github_markdown_converter = GitHubMarkdownConverter('user', 'project', 'p',
'mount')
         with mock.patch.object(tracker, 'datetime') as dt:
             dt.strptime.side_effect = lambda s,f: s
             importer.process_fields(ticket, issue)
@@ -134,6 +135,7 @@ class TestTrackerImporter(TestCase):
                 }
             ]
         importer = tracker.GitHubTrackerImporter()
+        importer.github_markdown_converter = GitHubMarkdownConverter('user', 'project', 'p',
'mount')
         importer.process_comments(extractor, ticket, issue)
         self.assertEqual(ticket.discussion_thread.add_post.call_args_list[0], mock.call(
                 text='*Originally posted by:* [me](https://github.com/me)\nhello',
@@ -208,6 +210,7 @@ def hello(name):
             'labels': [{'name': 'first'}, {'name': 'second'}],
         }
         importer = tracker.GitHubTrackerImporter()
+        importer.github_markdown_converter = GitHubMarkdownConverter('user', 'project', 'p',
'mount')
         with mock.patch.object(tracker, 'datetime') as dt:
             dt.strptime.side_effect = lambda s,f: s
             importer.process_fields(ticket, issue)
@@ -238,6 +241,7 @@ def hello(name):
                 }
             ]
         importer = tracker.GitHubTrackerImporter()
+        importer.github_markdown_converter = GitHubMarkdownConverter('user', 'project', 'p',
'mount')
         importer.process_comments(extractor, ticket, issue)
         self.assertEqual(ticket.discussion_thread.add_post.call_args_list[0], mock.call(
                 text=body_converted,


Mime
View raw message