Documentation

Horetu takes function documentation from the docstring, expecting the same format that sphinx.ext.autodoc expects.

def lp(pdf: InputBinaryFile, sides: SIDES='two-sided-long-edge', copies: int=1,
       page_list: PageList=None, mail: Mail=None, margin: float=10):
    '''
    Print a PDF file from the downstairs printer.

    :param pdf: PDF file to print
    :param sides: One-sided or two-sided
    :param int copies: Number of copies
    :param page_list: Specifies which pages to print in the document.
        The list can contain a list of numbers and ranges (#-#)
        separated  by  commas,  e.g.,  "1,3-5,16".
    :param mail: Send mail to this email address after the file has been printed.
    :param margin: Specifies the margins of the print
    '''

Horetu ignores any parameter types that are specified in docstrings.

Sometimes it is necessary to print the name of a program. Horetu tries to guess this based on function names and file names, but you can force a particular name in the horetu.Program call.

horetu.wsgi_form(horetu.Program(lp, name='print-server'))

Horetu exceptions

If you raise a horetu.exceptions.Error, horetu will format the error message in a way that works nicely for the particular interface that you are using. Unless you are modifying horetu itself, this is the only etu exception that you should need to use.

class horetu.exceptions.Error(message=None, section=(), param=None)[source]

Return annotations

You can set the content type of a function’s output in its return annotation. This will affect how the output is rendered.