Parent: [a28a7b] (diff)

Child: [ddf08c] (diff)

Download this file

event_tasks.py    20 lines (16 with data), 532 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
import sys
from allura.lib.decorators import task, event_handler
from allura.lib.exceptions import CompoundError
@task
def event(event_type, *args, **kwargs):
exceptions = []
for t in event_handler.listeners[event_type]:
try:
t(event_type, *args, **kwargs)
except:
exceptions.append(sys.exc_info())
if exceptions:
if len(exceptions) == 1:
raise exceptions[0][0], exceptions[0][1], exceptions[0][2]
else:
raise CompoundError(*exceptions)