You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/08/20 15:28:39 UTC

[13/25] git commit: [#6506] Fixed unicode and attribute errors

[#6506] Fixed unicode and attribute errors

Signed-off-by: Cory Johns <cj...@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/08758635
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/08758635
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/08758635

Branch: refs/heads/db/6482
Commit: 0875863598e47a5d1990f3ae6b0d8edd04ddaa6c
Parents: 37aacca
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Aug 15 20:55:35 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Aug 15 20:55:35 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/import_support.py             | 12 ++++++------
 ForgeTracker/forgetracker/scripts/import_tracker.py     |  2 +-
 .../forgewiki/scripts/wiki_from_trac/extractors.py      |  6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/08758635/ForgeTracker/forgetracker/import_support.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/import_support.py b/ForgeTracker/forgetracker/import_support.py
index e22c50e..9637ebc 100644
--- a/ForgeTracker/forgetracker/import_support.py
+++ b/ForgeTracker/forgetracker/import_support.py
@@ -199,10 +199,10 @@ class ImportSupport(object):
                 new_f, conv = transform
                 remapped[new_f] = conv(v)
 
-        description = self.link_processing(remapped['description'])
+        description = h.really_unicode(self.link_processing(remapped['description']))
         if ticket_dict['submitter'] and not remapped['reported_by_id']:
-            description = 'Originally created by: {0}\n\n{1}'.format(
-                    ticket_dict['submitter'], description)
+            description = u'Originally created by: {0}\n\n{1}'.format(
+                    h.really_unicode(ticket_dict['submitter']), description)
         remapped['description'] = description
 
         ticket_num = ticket_dict['id']
@@ -273,10 +273,10 @@ class ImportSupport(object):
     def make_comment(self, thread, comment_dict):
         ts = self.parse_date(comment_dict['date'])
         author_id = self.get_user_id(comment_dict['submitter'])
-        text = self.link_processing(comment_dict['comment'])
+        text = h.really_unicode(self.link_processing(comment_dict['comment']))
         if not author_id and comment_dict['submitter']:
-            text = 'Originally posted by: {0}\n\n{1}'.format(
-                    comment_dict['submitter'], text)
+            text = u'Originally posted by: {0}\n\n{1}'.format(
+                    h.really_unicode(comment_dict['submitter']), text)
         comment = thread.post(text=text, timestamp=ts)
         comment.author_id = author_id
         comment.import_id = c.api_token.api_key

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/08758635/ForgeTracker/forgetracker/scripts/import_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/scripts/import_tracker.py b/ForgeTracker/forgetracker/scripts/import_tracker.py
index 32b4d1c..c60a775 100644
--- a/ForgeTracker/forgetracker/scripts/import_tracker.py
+++ b/ForgeTracker/forgetracker/scripts/import_tracker.py
@@ -60,7 +60,7 @@ def import_tracker(cli, project, tool, import_options, doc_txt,
         doc_import['trackers']['default'] = {}
         doc_import['trackers']['default']['artifacts'] = [ticket_in]
         res = cli.call(url, doc=json.dumps(doc_import), options=json.dumps(import_options))
-        assert res['status'] and not res['errors']
+        assert res['status'] and not res['errors'], res['errors']
         if validate:
             if res['warnings']:
                 print "Ticket id %s warnings: %s" % (ticket_in['id'], res['warnings'])

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/08758635/ForgeWiki/forgewiki/scripts/wiki_from_trac/extractors.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/scripts/wiki_from_trac/extractors.py b/ForgeWiki/forgewiki/scripts/wiki_from_trac/extractors.py
index af07f50..6415bbf 100644
--- a/ForgeWiki/forgewiki/scripts/wiki_from_trac/extractors.py
+++ b/ForgeWiki/forgewiki/scripts/wiki_from_trac/extractors.py
@@ -138,7 +138,7 @@ class WikiExporter(object):
         url = urljoin(self.base_url, self.PAGE_LIST_URL)
         self.log('Fetching list of pages from %s' % url)
         r = self.fetch(url)
-        html = BeautifulSoup(r.content)
+        html = BeautifulSoup(r)
         pages = html.find('div', attrs=self.CONTENT_DIV_ATTRS) \
                     .find('ul').findAll('li')
         pages = [page.find('a').text
@@ -165,14 +165,14 @@ class WikiExporter(object):
         url = self.url(self.PAGE_URL % title)
         self.log('Fetching page %s' % url)
         r = self.fetch(url)
-        html = BeautifulSoup(r.content)
+        html = BeautifulSoup(r)
         return html.find('div', attrs=self.CONTENT_DIV_ATTRS)
 
     def _get_page_regex(self, title):
         url = self.url(self.PAGE_URL % title, 'txt')
         self.log('Fetching page %s' % url)
         r = self.fetch(url)
-        return r.content
+        return r
 
     def convert_title(self, title):
         title = self.RENAME_PAGES.get(title, title)