def get_bugmail_messages(): """ Check bugmail for updated bugs, and get their data from Bugzilla. """ msgs = get_bugmails() bugids = store_messages(msgs) if bugids: update_bugs.delay(bugids)
def get_bugmail_messages(): """ Check bugmail for updated bugs, and get their data from Bugzilla. """ msgs = get_bugmails() if msgs: for bid, msg in msgs.iteritems(): bug_data = extract_bug_info(msg) bug, created = Bug.objects.get_or_create(id=bid, defaults=bug_data) if not created: for attr, val in bug_data.items(): setattr(bug, attr, val) bug.save() bugids = msgs.keys() update_bugs.delay(bugids) log.info('Synced %d bug(s) from email', len(bugids))