File: //usr/lib/python3/dist-packages/django/views/__pycache__/defaults.cpython-310.pyc
o
3�a; � @ s� d dl mZ d dlmZmZmZmZ d dlmZm Z m
Z
mZ d dlm
Z
dZdZdZdZd Ze
efd
d��Ze
efdd
��Ze
efdd��Ze
efdd��ZdS )� )�quote)�HttpResponseBadRequest�HttpResponseForbidden�HttpResponseNotFound�HttpResponseServerError)�Context�Engine�TemplateDoesNotExist�loader)�requires_csrf_tokenz404.htmlz403.htmlz400.htmlz500.htmlz�
<!doctype html>
<html lang="en">
<head>
<title>%(title)s</title>
</head>
<body>
<h1>%(title)s</h1><p>%(details)s</p>
</body>
</html>
c C s� |j j}z|jd }W n ttfy Y nw t|t�r|}t| j�|d�}zt �
|�}|�|| �}d}W n" tyW |t
krA� t� �tddd� �}|�t|��}d}Y nw t||d�S ) a�
Default 404 handler.
Templates: :template:`404.html`
Context:
request_path
The path of the requested URL (e.g., '/app/pages/bad_page/'). It's
quoted to prevent a content injection attack.
exception
The message from the exception which triggered the 404 (if one was
supplied), or the exception class name
r )�request_path� exceptionNz Not Foundz4The requested resource was not found on this server.��title�details� text/html��content_type)� __class__�__name__�args�AttributeError�
IndexError�
isinstance�strr �pathr
�get_template�renderr �ERROR_404_TEMPLATE_NAMEr �from_string�ERROR_PAGE_TEMPLATEr r ) �requestr
�
template_name�exception_repr�message�context�template�bodyr � r( �7/usr/lib/python3/dist-packages/django/views/defaults.py�page_not_found s8 �
�
���r* c C sN zt �|�}W n ty |tkr� ttddd� dd� Y S w t|�� �S )zS
500 error handler.
Templates: :template:`500.html`
Context: None
zServer Error (500)� r r r )r
r r �ERROR_500_TEMPLATE_NAMEr r r )r! r"