1 # Copyright (C) 2010-2012 W. Trevor King <wking@drexel.edu>
3 # This file is part of Hooke.
5 # Hooke is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option) any
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with Hooke. If not, see <http://www.gnu.org/licenses/>.
18 from ....util.pluggable import IsSubclass, construct_odict
29 """List of handler modules. TODO: autodiscovery
32 class Handler (object):
33 """Base class for :class:`~hooke.interaction.Request` handlers.
35 :attr:`name` identifies the request type and should match the
38 def __init__(self, name):
41 def run(self, hooke_frame, msg):
44 def _cancel(self, *args, **kwargs):
45 # TODO: somehow abort the running command
49 HANDLERS = construct_odict(
50 this_modname=__name__,
51 submodnames=HANDLER_MODULES,
52 class_selector=IsSubclass(Handler, blacklist=[Handler]))
53 """:class:`hooke.compat.odict.odict` of :class:`Handler`
54 instances keyed by `.name`.