CAT-SOOP API: catsoop.errors

Utilities for generating error messages and displaying error pages

View Source

Members

  • catsoop.errors.clear_info (function, lines 53-83)

    Clear sensitive information from a string

    In particular, this function clears the cs_fs_root and cs_data_root from tracebacks, as well as any information specified by the cs_extra_clear variable. It also removes the current user's session ID and API token if they are present.

    Parameters:

    • context: the context associated with this request
    • text: the text (typically a traceback) from which the information should be removed.

    Returns: the input string, but with sensitive data replaced.

 

  • catsoop.errors.do_404_message (function, lines 177-208)

    Display an error page (404 File Not Found), including a sensible error message.

    Parameters:

    • context: the context associated with this request

    Returns: a 3-tuple, as expected by catsoop.wsgi.application

 

  • catsoop.errors.do_error_message (function, lines 130-174)

    Display an error page (500 Internal Server Error), including a sensible error message.

    Parameters:

    • context: the context associated with this request

    Optional Parameters:

    • msg (default None): a custom message to be displayed. If no message is specified, the output from catsoop.errors.error_message_content is used (which tries to provide a meaningful error message based on the last exception.

    Returns: a 3-tuple, as expected by catsoop.wsgi.application

 

  • catsoop.errors.error_404_logo (str)

    This alternate logo replaces the CAT-SOOP logo on when a 404 (File Not Found) error is encountered.

 

  • catsoop.errors.error_500_logo (str)

    This alternate logo replaces the CAT-SOOP logo on when a 500 (Internal Server Error) error is encountered.

 

  • catsoop.errors.error_message_content (function, lines 86-127)

    Returns a string containing an appropriate error message.

    This function bases its output on the last exception, but it also tries to take into account changes that the CAT-SOOP system makes to some input files.

    Parameters:

    • context: the context associated with this request

    Optional Parameters:

    • html (default True): whether the output should be HTML-escaped

    Returns: an error message appropriate for the last exception

 

  • catsoop.errors.html_format (function, lines 31-50)

    Returns an HTML-escaped version of the input string, suitable for insertion into a <pre> tag

    Parameters:

    • string: the string to be escaped

    Returns: an HTML-escaped version of the input string