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') bugCardName = mingle.generateMingleBugCardName( bug.get('id', '---'), bug.get('summary').encode('ascii', 'ignore')) # set common mingle parameters description = comments.get('comments')[0].get('text') + link cardParams = { 'card[name]': bugCardName, 'card[card_type_name]': bugCard, 'card[description]': description, 'card[created_by]': auth['username'], } cardLocation = mingle.addCard(cardParams) bingle.info(mingle.dumpRequest()) postComments(auth, apiBaseUrl, comments, cardLocation) # set custom mingle properties