[Zope-CVS] CVS: Products/Event - EventRegistry.py:1.6

Ken Manheimer klm@zope.com
Tue, 8 Oct 2002 13:06:06 -0400


Update of /cvs-repository/Products/Event
In directory cvs.zope.org:/tmp/cvs-serv7008

Modified Files:
	EventRegistry.py 
Log Message:
.registerEvent(): Return the key so consumers have a way to access the
event they registered without having to list them all.  We return the
key whether or not the event has already been registered.


=== Products/Event/EventRegistry.py 1.5 => 1.6 ===
--- Products/Event/EventRegistry.py:1.5	Sat Sep 21 12:31:08 2002
+++ Products/Event/EventRegistry.py	Tue Oct  8 13:06:05 2002
@@ -73,12 +73,14 @@
         'title'         the title of the interface
         'description'   documentation for the event. If not given, the
                         docstring of the event interface is used instead.
+
+        Returns the key that will be used to access the event.
         """
         key = '%s.%s' % (interface.__module__, interface.__name__)
         if _registry.has_key( key ):
             LOG('EventRegistry', WARNING,
                 'Duplicate registration for event: %s' % key)
-            return
+            return key
 
         if description is None:
             description = reindentDocstring(interface.__doc__)
@@ -86,6 +88,8 @@
         _registry[key] = {'interface': interface, 'title': title,
                           'description': description}
 
+
+        return key
 
 eventRegistry = EventRegistry()