def to_yt_comment(target, comment): c = Comment() author = comment[u'author'] import_user(target, author) c.text = comment[u'text'] if not len(c.text): c.text = "Text is missing" c.author = author[u'userName'] c.created = str(to_unix_date(comment[u'createTime'])) return c
def to_yt_comment(target, comment): c = Comment() author = comment[u"author"] import_user(target, author) c.text = comment[u"text"] if not len(c.text): c.text = "Text is missing" c.author = author[u"userName"] c.created = str(to_unix_date(comment[u"createTime"])) return c
def _to_yt_comment(self, comment): if isinstance(comment, str) or isinstance(comment, unicode): result = Comment() result.author = u'guest' result.text = comment result.created = str(int(time.time() * 1000)) return result if isinstance(comment, list): yt_user = self._to_yt_user(comment[0]) self._import_user(yt_user) result = Comment() result.author = yt_user.login result.created = self._import_config._to_unix_date(comment[1]) result.text = comment[2] return result
def _to_yt_comment(self, comment): if isinstance(comment, str) or isinstance(comment, unicode): result = Comment() result.authorLogin = u'guest' result.text = comment result.created = comment.created = str(int(time.time() * 1000)) return result
def _to_yt_comment(self, comment): if isinstance(comment, str) or isinstance(comment, unicode): result = Comment() result.author = u'guest' result.text = comment result.created = str(int(time.time() * 1000)) return result
def create_yt_issue_from_jira_issue(target, issue, project_id): yt_issue = Issue() yt_issue['comments'] = [] yt_issue.numberInProject = issue['key'][(issue['key'].find('-') + 1):] for field in issue['fields'].values(): field_type = get_yt_field_type(field[u'type']) field_name = get_yt_field_name(field[u'name']) if field_name == 'comment': for comment in field['value']: yt_comment = Comment() yt_comment.text = comment['body'] comment_author_name = "guest" if 'author' in comment: comment_author = comment['author'] create_user(target, comment_author) comment_author_name = comment_author['name'] yt_comment.author = comment_author_name.replace(' ', '_') yt_comment.created = to_unix_date(comment['created']) yt_comment.updated = to_unix_date(comment['updated']) yt_issue['comments'].append(yt_comment) elif (field_name is not None) and (field_type is not None): if 'value' in field: value = field['value'] if len(value): if isinstance(value, list): yt_issue[field_name] = [] for v in value: create_value(target, v, field_name, field_type, project_id) yt_issue[field_name].append(get_value_presentation(field_type, v)) else: create_value(target, value, field_name, field_type, project_id) yt_issue[field_name] = get_value_presentation(field_type, value) return yt_issue
def _to_yt_comment(self, comment): yt_comment = Comment() user = self._to_yt_user(comment[u'author_id']) self._import_user(user) yt_comment.author = user.login yt_comment.text = comment[u'body'] yt_comment.created = self.to_unix_date(comment[u'created_at']) return yt_comment
def _to_yt_comment(self, comment): result = None if isinstance(comment, basestring): result = Comment() result.author = u'guest' result.text = comment result.created = str(int(time.time() * 1000)) elif isinstance(comment, list): yt_user = self._to_yt_user(comment[0]) self._import_user(yt_user) result = Comment() result.author = yt_user.login result.created = self._import_config.to_unix_date(comment[1]) result.text = comment[2] if result and getattr(csvClient, 'USE_MARKDOWN', False): result.markdown = "true" return result
def _to_yt_comment(self, comment): yt_comment = Comment() user = self._to_yt_user(comment[u"author_id"]) self._import_user(user) yt_comment.author = user.login yt_comment.text = comment[u"body"] yt_comment.created = self.to_unix_date(comment[u"created_at"]) return yt_comment
def to_yt_comment(target, comment): yt_comment = Comment() yt_comment.author = comment.author[0].name.text create_user(target, yt_comment.author) if comment.content.text is None: return None yt_comment.text = comment.content.text.encode('utf-8') yt_comment.created = to_unix_date(comment.published.text) return yt_comment
def to_yt_issue(target, issue, project_id, fields_mapping=None, value_mappings=None): yt_issue = Issue() yt_issue['comments'] = [] yt_issue.numberInProject = issue['key'][(issue['key'].find('-') + 1):] for field, value in issue['fields'].items(): if value is None: continue if fields_mapping and field.lower() in fields_mapping: field_name, field_type = fields_mapping[field.lower()] else: field_name = get_yt_field_name(field) field_type = get_yt_field_type(field_name) if field_name == 'comment': for comment in value['comments']: yt_comment = Comment() yt_comment.text = comment['body'] comment_author_name = "guest" if 'author' in comment: comment_author = comment['author'] create_user(target, comment_author) comment_author_name = comment_author['name'] yt_comment.author = comment_author_name.replace(' ', '_') yt_comment.created = to_unix_date(comment['created']) yt_comment.updated = to_unix_date(comment['updated']) yt_issue['comments'].append(yt_comment) elif (field_name is not None) and (field_type is not None): if isinstance(value, list) and len(value): yt_issue[field_name] = [] for v in value: if isinstance(v, dict): v['name'] = get_yt_field_value(field_name, v['name'], value_mappings) else: v = get_yt_field_value(field_name, v, value_mappings) create_value(target, v, field_name, field_type, project_id) yt_issue[field_name].append(get_value_presentation(field_type, v)) else: if field_name.lower() == 'estimation': if field_type == 'period': value = int(int(value) / 60) elif field_type == 'integer': value = int(int(value) / 3600) if isinstance(value, int): value = str(value) if len(value): if isinstance(value, dict): value['name'] = get_yt_field_value(field_name, value['name'], value_mappings) else: value = get_yt_field_value(field_name, value, value_mappings) create_value(target, value, field_name, field_type, project_id) yt_issue[field_name] = get_value_presentation(field_type, value) elif _debug: print 'DEBUG: unclassified field', field_name return yt_issue
def create_yt_issue_from_jira_issue(target, issue, project_id): yt_issue = Issue() yt_issue['comments'] = [] yt_issue.numberInProject = issue['key'][(issue['key'].find('-') + 1):] for field, value in issue['fields'].items(): if value is None: continue field_name = get_yt_field_name(field) field_type = get_yt_field_type(field_name) if field_name == 'comment': for comment in value['comments']: yt_comment = Comment() yt_comment.text = comment['body'] comment_author_name = "guest" if 'author' in comment: comment_author = comment['author'] create_user(target, comment_author) comment_author_name = comment_author['name'] yt_comment.author = comment_author_name.replace(' ', '_') yt_comment.created = to_unix_date(comment['created']) yt_comment.updated = to_unix_date(comment['updated']) yt_issue['comments'].append(yt_comment) elif (field_name is not None) and (field_type is not None): if isinstance(value, list) and len(value): yt_issue[field_name] = [] for v in value: create_value(target, v, field_name, field_type, project_id) yt_issue[field_name].append( get_value_presentation(field_type, v)) else: if isinstance(value, int): value = str(value) if len(value): create_value(target, value, field_name, field_type, project_id) yt_issue[field_name] = get_value_presentation( field_type, value) else: print field_name return yt_issue
def _to_yt_comment(fb_comment): comment = Comment() comment.author = fb_comment.author.replace(" ", "_") comment.text = fb_comment.text comment.created = fb_comment.date return comment
def _to_yt_comment(fb_comment) : comment = Comment() comment.author = fb_comment.author.replace(" ", "_") comment.text = fb_comment.text comment.created = fb_comment.date return comment
def to_yt_comment(reporter, comment_string): comment = Comment() comment.author = reporter comment.text = comment_string comment.created = str(int(time.time() * 1000)) return comment