comparison MoinMoin/events/__init__.py @ 2073:afa784d8d58d

Handle PluginErrors while loading event handlers gracefully.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Fri, 01 Jun 2007 01:42:38 +0200
parents 5cc8f6714297
children 0128bbaf0172
comparison
equal deleted inserted replaced
2072:d347a0303be1 2073:afa784d8d58d
9 @license: GNU GPL, see COPYING for details. 9 @license: GNU GPL, see COPYING for details.
10 """ 10 """
11 11
12 from MoinMoin import wikiutil 12 from MoinMoin import wikiutil
13 from MoinMoin.util import pysupport 13 from MoinMoin.util import pysupport
14 from MoinMoin.wikiutil import PluginAttributeError
14 15
15 # A list of available event handlers 16 # A list of available event handlers
16 event_handlers = None 17 event_handlers = None
17 18
18 # Create a list of extension actions from the package directory 19 # Create a list of extension actions from the package directory
66 67
67 event_handlers = [] 68 event_handlers = []
68 names = wikiutil.getPlugins("events", cfg) 69 names = wikiutil.getPlugins("events", cfg)
69 70
70 for name in names: 71 for name in names:
71 handler = wikiutil.importPlugin(cfg, "events", name, "handle") 72 try:
73 handler = wikiutil.importPlugin(cfg, "events", name, "handle")
74 except PluginAttributeError:
75 handler = None
76 pass
72 77
73 if handler is not None: 78 if handler is not None:
74 event_handlers.append(handler) 79 event_handlers.append(handler)
75 80
76 def send_event(event): 81 def send_event(event):