Beispiel #1
0
def main(pulse_opts):
    global pulse_cfg
    pulse_cfg.update(pulse_opts)
    publisher = BugzillaPublisher(**pulse_cfg)

    count = 0
    for msg in get_messages():
        bug_data = extract_bug_info(msg)
        publish_message(publisher, bug_data, "org.mozilla.bugzilla.exchange")
        count += 1
    print "Synced %d bug(s) from email" % count
Beispiel #2
0
def exec_test(path):
    fp = open(path)
    contents = fp.read()
    fp.close()
    contents = contents.split("===EXPECTED===")
    msg = email.message_from_string(contents[0])
    bug_data = utils.extract_bug_info(msg)
    expected = "" if not contents[1].strip() else eval(contents[1].strip())
    if bug_data != expected:
        print "%s\n  Got |%s|, expected |%s|" % (f, str(bug_data), expected)
    return bug_data == expected
Beispiel #3
0
import email
import datetime
from email.parser import Parser
from utils import get_messages, extract_bug_info
from mongotools import MongoConnection
from tools import classify_volunteer

with MongoConnection() as conn:
    count = 0
    for msg in get_messages():
        try:
            all_data = extract_bug_info(msg)
        except:
            continue

        who = all_data['changed_by']
        all_data.pop('changed_by')

        author_info = who
        if 'author_name' in all_data:
            author_info += " " + all_data['author_name']
            all_data.pop('author_name')
        volunteer = classify_volunteer(author_info)

        all_data['volunteer_assignee'] = classify_volunteer(all_data['assignee'])

        when_str = all_data['changed_at']
        when_tuple = email.utils.parsedate_tz(when_str)
        when = datetime.datetime.fromtimestamp(email.utils.mktime_tz(when_tuple))
        all_data.pop('changed_at')
        source = 'bugzilla'