diff options
-rw-r--r-- | docs/classhandler.rst | 3 | ||||
-rw-r--r-- | src/zope/event/classhandler.py | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/docs/classhandler.rst b/docs/classhandler.rst index 3135aa1..d007613 100644 --- a/docs/classhandler.rst +++ b/docs/classhandler.rst @@ -3,3 +3,6 @@ ============================ .. automodule:: zope.event.classhandler + :no-members: + +.. autofunction:: handler(event_class, [handler]) diff --git a/src/zope/event/classhandler.py b/src/zope/event/classhandler.py index c839901..3c80944 100644 --- a/src/zope/event/classhandler.py +++ b/src/zope/event/classhandler.py @@ -42,13 +42,14 @@ new-style event classes are supported, and then by order of registry. """ import zope.event -registry = {} +__all__ = [ + 'handler', +] -def handler(event_class, handler_=None, decorator=False): - """ - handler(event_class, [handler]) -> None +registry = {} - Define an event handler for a (new-style) class. +def handler(event_class, handler_=None, _decorator=False): + """ Define an event handler for a (new-style) class. This can be called with a class and a handler, or with just a class and the result used as a handler decorator. @@ -64,7 +65,7 @@ def handler(event_class, handler_=None, decorator=False): else: registry[event_class].append(handler_) - if decorator: + if _decorator: return handler def dispatch(event): |