Commits

Manabu TERADA committed 0ab12d3

modify gettging comment for issue backup

  • Participants
  • Parent commits 856945e

Comments (0)

Files changed (1)

c2/recipe/bitbucketbk/backuprunner.py

 def _get_issue_comment(comments):
     for data in comments:
         title = data.get('content')
+        if title is None:
+            title = u""
 #        author = u"\n".join((u":".join(k, v) for k, v in data.get('author_info', {}).items() if v))
         author_dic = data.get('author_info', {})
-        author = author_dic.get('first_name') + u" " + author_dic.get('first_name')
+        f_name = author_dic.get('first_name')
+        l_name = author_dic.get('last_name')
+        if f_name is not None and l_name is not None:
+            author = f_name + u" " + l_name
+        else:
+            author = u""
+        #author = author_dic.get('first_name') + u" " + author_dic.get('first_name')
         utc_updated_on = data.get('utc_updated_on')
+        if utc_updated_on is None:
+            utc_updated_on = u""
         yield u"\n".join((title, author, utc_updated_on))
         yield u"----------------"
 
                 sheet1.write(raw, ii, issue.get(head))
             elif head in [u'reported_by', u'responsible']:
                 reported_dic = issue.get(head, {})
-                data = reported_dic.get('first_name') + u" " + reported_dic.get('first_name')
-                sheet1.write(raw, ii, data)
+                f_name = reported_dic.get('first_name')
+                l_name = reported_dic.get('last_name')
+                if f_name is not None and l_name is not None:
+                    sheet1.write(raw, ii, f_name + u" " + l_name)
+                #data = reported_dic.get('first_name') + u" " + reported_dic.get('first_name')
+                #sheet1.write(raw, ii, data)
             elif head == u'comment':
                 if issue.get('comment_count') > 0:
                     comment_api_url = api_url + "/" + str(issue.get('local_id')) + "/comments"