
utils.py
About this file
This file contains the exception classes that are raised for invalid users, invalid determination with missing information, errors raised upon invalid actions for a request, duplicate file uploads, and PDF creation failure. The file also contains a function to decode base64 data and a function to determine the boolean of a request.
Code Check Report
No problems to report
Documentation drawn from source code
.. module: utils
InvalidUserException(Exception):
__init__(self, user):
Exception used when an invalid user is detected.:param user: the current_user as defined in flask_login
InvalidDeterminationException(Exception):
__init__(self, request_id, dtype, missing_field):
Exception used to handle missing information for a determination.:param request_id: Unique request identifier:param dtype: Type of determination (Acknowledgment, Extension, Closing, Denial, Re-Opening):param missing_field: The field missing from the determination.
UserRequestException(Exception):
__init__(self, action, request_id, reason):
Exception used to handle errors performing actions on a request.:param action: Action attempted:param request_id: Unique request identifier:param reason: Description of failure reason
DuplicateFileException(Exception):
__init__(self, file_name, request_id):
Exception used when a duplicate file is added to a request.:param file_name: Name of file uploaded:param request_id: Unique request identifier
PDFCreationException(Exception):
__init__(self, status_code, stdout=b'', stderr=b''):
Exception used when xhtml2pdf fails to create a PDF.:param status_code: Process exit status code:param stdout: STDOUT output:param stderr: STDERR output
b64decode_lenient(data):
Decodes base64 (bytes or str), padding being optional.:param data: a string or bytes-like object of base64 data:return: a decoded string
eval_request_bool(val, default=False):
Evaluates the boolean value of a request parameter.:param val: the value to check:param default: bool to return by default:return: Boolean