[Zope-Checkins] CVS: Products/EventListenerTool - ListenerTool.py:1.2

Chris McDonough chrism@zope.com
Tue, 7 Jan 2003 15:25:28 -0500


Update of /cvs-repository/Products/EventListenerTool
In directory cvs.zope.org:/tmp/cvs-serv1124

Modified Files:
	ListenerTool.py 
Log Message:
Do not raise an exception in the UI if an event type cannot be found.


=== Products/EventListenerTool/ListenerTool.py 1.1.1.1 => 1.2 ===
--- Products/EventListenerTool/ListenerTool.py:1.1.1.1	Fri Jan  3 14:33:21 2003
+++ Products/EventListenerTool/ListenerTool.py	Tue Jan  7 15:24:55 2003
@@ -326,7 +326,7 @@
                      )
 
     security.declareProtected( ManageEventListener, 'getEventTypeInfo')
-    def getEventTypeInfo( self, moniker ):
+    def getEventTypeInfo( self, moniker, raise_exc=1 ):
 
         """ Return a mapping describing the event type indicated by 'moniker'.
         
@@ -346,8 +346,16 @@
         for info in all:
             if moniker == info[0]:
                 return _buildEventInfoMapping( info )
-        else:
+            
+        if raise_exc:
             raise KeyError, moniker
+        else:
+            return {
+                'moniker':moniker,
+                'title':moniker,
+                'name':'Broken!',
+                'description':'Broken Event'
+                }
 
     security.declareProtected( ManageEventListener, 'listEventTypeInfo')
     def listEventTypeInfo( self ):