CAT-SOOP API: catsoop.errors
Members
-
catsoop.errors.clear_info (
function, lines 53-83)Clear sensitive information from a string
In particular, this function clears the
cs_fs_rootandcs_data_rootfrom tracebacks, as well as any information specified by thecs_extra_clearvariable. It also removes the current user's session ID and API token if they are present.Parameters:
context: the context associated with this requesttext: 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(defaultNone): a custom message to be displayed. If no message is specified, the output fromcatsoop.errors.error_message_contentis 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(defaultTrue): 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