comparison MoinMoin/events/__init__.py @ 2318:062b76cf8d48

Introduce an base EventResult class for event handler return values. Make send_notification use a list of jids, instead of one. I'll remove prints tomorrow.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Sat, 23 Jun 2007 00:01:56 +0200
parents a85d51778eda
children a43db0817020
comparison
equal deleted inserted replaced
2316:02824b69a95c 2318:062b76cf8d48
118 118
119 def __init__(self, request, user): 119 def __init__(self, request, user):
120 Event.__init__(self, request) 120 Event.__init__(self, request)
121 self.user = user 121 self.user = user
122 122
123 class EventResult:
124 """ This is a base class for messages passed from event handlers """
125 pass
126
123 def get_handlers(cfg): 127 def get_handlers(cfg):
124 """Create a list of available event handlers. 128 """Create a list of available event handlers.
125 129
126 Each handler is a handle() function defined in an plugin, 130 Each handler is a handle() function defined in an plugin,
127 pretty much like in case of actions. 131 pretty much like in case of actions.
156 cfg = event.request.cfg 160 cfg = event.request.cfg
157 161
158 # Try to handle the event with each available handler (for now) 162 # Try to handle the event with each available handler (for now)
159 for handle in cfg.event_handlers: 163 for handle in cfg.event_handlers:
160 retval = handle(event) 164 retval = handle(event)
161 if isinstance(retval, unicode): 165 if retval:
162 msg.append(retval) 166 msg.append(retval)
163 167
164 return msg 168 return msg
165 169
166 def get_subscribable_events(): 170 def get_subscribable_events():