3
g;                 @   s   d dl mZ d dlmZmZmZmZ d dlmZm	Z	m
Z
mZ d dlmZ dZdZdZdZd	Zeefd
dZeefddZeefddZeefddZdS )    )quote)HttpResponseBadRequestHttpResponseForbiddenHttpResponseNotFoundHttpResponseServerError)ContextEngineTemplateDoesNotExistloader)requires_csrf_tokenz404.htmlz403.htmlz400.htmlz500.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}y|jd }W n ttfk
r.   Y nX t|tr>|}t| j|d}yt	j
|}|j|| }d}W nF tk
r   |tkr t jtddd }|jt|}d}Y nX 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detailsz	text/html)content_type)	__class____name__argsAttributeError
IndexError
isinstancestrr   pathr
   get_templaterenderr	   ERROR_404_TEMPLATE_NAMEr   Zfrom_stringERROR_PAGE_TEMPLATEr   r   )	requestr   template_nameZexception_reprmessagecontexttemplatebodyr    r#   S/var/www/tester-filtro-web/env/lib/python3.6/site-packages/django/views/defaults.pypage_not_found   s.    


r%   c             C   sL   yt j|}W n0 tk
r>   |tkr( ttddd ddS X t|j S )zS
    500 error handler.

    Templates: :template:`500.html`
    Context: None
    zServer Error (500) )r   r   z	text/html)r   )r
   r   r	   ERROR_500_TEMPLATE_NAMEr   r   r   )r   r   r!   r#   r#   r$   server_errorO   s    
r(   c             C   sL   yt j|}W n0 tk
r>   |tkr( ttddd ddS X t|j S )zS
    400 error handler.

    Templates: :template:`400.html`
    Context: None
    zBad Request (400)r&   )r   r   z	text/html)r   )r
   r   r	   ERROR_400_TEMPLATE_NAMEr   r   r   )r   r   r   r!   r#   r#   r$   bad_requestd   s    
r*   c             C   sZ   yt j|}W n0 tk
r>   |tkr( ttddd ddS X t|j| dt|idS )z
    Permission denied (403) handler.

    Templates: :template:`403.html`
    Context: None

    If the template does not exist, an Http403 response containing the text
    "403 Forbidden" (as per RFC 7231) will be returned.
    z403 Forbiddenr&   )r   r   z	text/html)r   r   )r   r    )r
   r   r	   ERROR_403_TEMPLATE_NAMEr   r   r   r   )r   r   r   r!   r#   r#   r$   permission_denied}   s    
r,   N)urllib.parser   Zdjango.httpr   r   r   r   Zdjango.templater   r   r	   r
   Zdjango.views.decorators.csrfr   r   r+   r)   r'   r   r%   r(   r*   r,   r#   r#   r#   r$   <module>   s    0