Skip to content
Samuel Smith edited this page Jul 14, 2016 · 2 revisions

Decorator

doify

def doify(name,
          base=None,
          registry=None,
          parametric=None,
          inits=None,
          ioinits=None,
          parms=None):
    """ Parametrized decorator function that converts the decorated function
        into an Actor sub class with .action method and with class name name
        and registers the new subclass in the registry under name.
        If base is provided then register as subclass of base.
        Default base is Doer

        The parameters registry, parametric, inits, ioinits, and parms if provided,
        are used to create the class attributes for the new subclass
    """

Example

@doify('IoserveServerClose', ioinits=odict(valet=""))
def ioserveServerClose(self, **kwa):
    """
    Close server in valet

    Ioinit attributes:
        valet is a Valet instance

    Context: exit

    Example:
        do ioserve server close at exit
    """
    if self.valet.value:
        self.valet.value.servant.close()

        console.concise("Closed server '{0}' at '{1}'\n".format(
                            self.valet.name,
                            self.valet.value.servant.eha))

Clone this wiki locally