bingle.info('Existing card(s) %s match bug %s, so skip it.' % (','.join([str(m['Number']) for m in foundBug]), bug.get('id'))) continue else: bingle.info('Did not find card matching bug %s, so add it.' % (bug.get('id'))) # retrieve bug comments comment_payload = { 'method': 'Bug.comments', 'params': json.dumps([{ 'ids': ['%s' % bug.get('id')] }]) } comments = bingle.getBugComments(comment_payload, bug.get('id')) link = '<br><p>Full bug report at https://bugzilla.wikimedia.org/%s' \ '</p>' % bug.get('id') # set common mingle parameters description = htmlEscape( comments.get('comments')[0].get('text')).replace("\n", "<br />") + link cardParams = { 'card[name]': bugCardName, 'card[card_type_name]': bugCard, 'card[description]': description, 'card[created_by]': auth['username'], }
foundBug = mingle.findCardNumByName( bugCard, bugCardName) bingle.info(mingle.dumpRequest()) if len(foundBug) > 0: bingle.info('Existing card(s) %s match bug %s, so skip it.' % ( ','.join([str(m['Number']) for m in foundBug]), bug.get('id'))) continue else: bingle.info('Did not find card matching bug %s, so add it.' % (bug.get('id'))) # retrieve bug comments comment_payload = {'method': 'Bug.comments', 'params': json.dumps( [{'ids': ['%s' % bug.get('id')]}])} comments = bingle.getBugComments(comment_payload, bug.get('id')) link = '<br><p>Full bug report at https://bugzilla.wikimedia.org/%s' \ '</p>' % bug.get('id') # set common mingle parameters description = htmlEscape( comments.get('comments')[0].get('text')).replace( "\n", "<br />") + link cardParams = { 'card[name]': bugCardName, 'card[card_type_name]': bugCard, 'card[description]': description, 'card[created_by]': auth['username'], }
cards = trello.searchCardsByName(cardTitle) # check if we actually have a match # it looks like the API search query might do a fuzzy search, so we want to # make sure we only get a full match for card in cards: if card['name'] == cardTitle: cardExists = True if cardExists: if debug: print "Card %s already exists." % cardTitle continue # retrieve bug comments @TODO refactor this (duplicating from bingle) comment_payload = {'method': 'Bug.comments', 'params': json.dumps( [{'ids': ['%s' % bugId]}])} comments = bingle.getBugComments(comment_payload, bugId) link = '<br><p>Full bug report at https://bugzilla.wikimedia.org/%s' \ '</p>' % bugId # set common mingle parameters description = comments.get('comments')[0].get('text').replace( "\n", "<br />") + link # add card to current board result = trello.postNewCard(cardTitle, html2text.html2text(description), tListId) # post comment back to bz comment = 'Prioritization and scheduling of this bug is tracked on ' \ 'Trello card %s' % (result.json().get('shortUrl')) bugzilla_payload = { 'jsonrpc': '1.1',
for card in cards: if card['name'] == cardTitle: cardExists = True if cardExists: if debug: print "Card %s already exists." % cardTitle continue # retrieve bug comments @TODO refactor this (duplicating from bingle) comment_payload = { 'method': 'Bug.comments', 'params': json.dumps([{ 'ids': ['%s' % bugId] }]) } comments = bingle.getBugComments(comment_payload, bugId) link = '<br><p>Full bug report at https://bugzilla.wikimedia.org/%s' \ '</p>' % bugId # set common mingle parameters description = comments.get('comments')[0].get('text').replace( "\n", "<br />") + link # add card to current board result = trello.postNewCard(cardTitle, html2text.html2text(description), tListId) # post comment back to bz comment = 'Prioritization and scheduling of this bug is tracked on ' \ 'Trello card %s' % (result.json().get('shortUrl')) bugzilla_payload = {