def define(self, interface):
        """
        Define a handler based on the provided interface.  Defines a handler
        type based on ``<interface>.IMeta.label``.

        :param interface: The interface class that defines the interface to be
            implemented by handlers.
        :raises: :class:`cement.core.exc.InterfaceError`
        :raises: :class:`cement.core.exc.FrameworkError`

        Usage:

        .. code-block:: python

            app.handler.define(IDatabaseHandler)

        """
        if not hasattr(interface, 'IMeta'):
            raise exc.InterfaceError("Invalid %s, " % interface +
                                     "missing 'IMeta' class.")
        if not hasattr(interface.IMeta, 'label'):
            raise exc.InterfaceError("Invalid %s, " % interface +
                                     "missing 'IMeta.label' class.")

        LOG.debug("defining handler type '%s' (%s)" %
                  (interface.IMeta.label, interface.__name__))

        if interface.IMeta.label in self.__handlers__:
            raise exc.FrameworkError("Handler type '%s' already defined!" %
                                     interface.IMeta.label)
        self.__handlers__[interface.IMeta.label] = {
            '__interface__': interface
        }
dataset/ETHPy150Open datafolklabs/cement/cement/core/handler.py/HandlerManager.define/original