diff options
author | Jason Madden <jamadden@gmail.com> | 2018-03-22 11:57:03 -0500 |
---|---|---|
committer | Jason Madden <jamadden@gmail.com> | 2018-03-22 11:57:03 -0500 |
commit | f7f85811605b354c43c511ec980bcc543bb6fc30 (patch) | |
tree | 8e93f044588f724666f073bf218146ae8616a5cf | |
parent | c23444edde95141192d46b98276de1d0206d9a97 (diff) | |
download | zope-event-f7f85811605b354c43c511ec980bcc543bb6fc30.tar.gz |
Move the function signature to the .rst file per discussion.dry-classhandler-docs
Also rename decorator to _decorator per discussion.
-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): |