Exemplo n.º 1
0
def collect_event(e):
    """\
		Run an event through the system.
		Create a list of things to be done for this event.
		"""
    from homevent.logging import log_created

    work = ConditionalWorkSequence(e, None)
    for wp in work_prios:
        for w in workers[wp]:
            if w.does_event(e):
                w.match_count += 1
                work.append(w)
    log_created(work)
    return work
Exemplo n.º 2
0
def collect_failure(e):
    """\
		Run a failure through the system.
		Create a list of things to be done for it.
		"""
    from homevent.logging import log_created
    from homevent.event import Event

    assert isinstance(e, (Event, BaseException)), "Cannot be used as an event: " + repr(e)

    work = WorkSequence(e, None)
    for wp in work_prios:
        for w in workers[wp]:
            if isinstance(w, ExcWorker) and w.does_failure(e):
                work.append(w)
    log_created(work)
    return work