o
    >h                     @   s   d Z dZddlmZ ddlmZ ddlmZmZ ddl	m
Z
mZ ddlmZmZ G dd	 d	eZd
edededefddZ		ddedede
fddZ	ddedede
fddZdS )z*
Utility implementations of L{IResource}.
)	errorPagenotFound	forbidden    )cast)http)IRenderableIRequest)	IResourceResource)renderElementtagsc                       sZ   e Zd ZdZdedededdf fddZd	edefd
dZ	de
d	edefddZ  ZS )
_ErrorPagea!  
    L{_ErrorPage} is a resource that responds to all requests with a particular
    (parameterized) HTTP status code and an HTML body containing some
    descriptive text. This is useful for rendering simple error pages.

    @see: L{twisted.web.pages.errorPage}

    @ivar _code: An integer HTTP status code which will be used for the
        response.

    @ivar _brief: A short string which will be included in the response body as
        the page title.

    @ivar _detail: A longer string which will be included in the response body.
    codebriefdetailreturnNc                    s    t    || _|| _|| _d S )N)super__init___code_brief_detail)selfr   r   r   	__class__ q/var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/twisted/web/pages.pyr   (   s   

z_ErrorPage.__init__requestc                 C   sb   | | j |dd t|ttttt	| j d| j
 tt| j
t| jS )z
        Respond to all requests with the given HTTP status code and an HTML
        document containing the explanatory strings.
        s   content-types   text/html; charset=utf-8z - )setResponseCoder   	setHeaderr   r   r   r   htmlheadtitler   bodyh1pr   )r   r   r   r   r   render.   s   z_ErrorPage.renderpathc                 C   s   | S )z
        Handle all requests for which L{_ErrorPage} lacks a child by returning
        this error page.

        @param path: A path segment.

        @param request: HTTP request
        r   )r   r&   r   r   r   r   getChildC   s   	z_ErrorPage.getChild)__name__
__module____qualname____doc__intstrr   r   objectr%   bytesr
   r'   __classcell__r   r   r   r   r      s
    r   r   r   r   r   c                 C   s   t | ||S )az  
    Build a resource that responds to all requests with a particular HTTP
    status code and an HTML body containing some descriptive text. This is
    useful for rendering simple error pages.

    The resource dynamically handles all paths below it. Use
    L{IResource.putChild()} to override a specific path.

    @param code: An integer HTTP status code which will be used for the
        response.

    @param brief: A short string which will be included in the response
        body as the page title.

    @param detail: A longer string which will be included in the
        response body.

    @returns: An L{IResource}
    )r   )r   r   r   r   r   r   r   O   s   r   No Such Resource%Sorry. No luck finding that resource.messagec                 C      t tj| |S )a  
    Generate an L{IResource} with a 404 Not Found status code.

    @see: L{twisted.web.pages.errorPage}

    @param brief: A short string displayed as the page title.

    @param brief: A longer string displayed in the page body.

    @returns: An L{IResource}
    )r   r   	NOT_FOUNDr   r3   r   r   r   r   f   s   r   Forbidden ResourceSorry, resource is forbidden.c                 C   r4   )a  
    Generate an L{IResource} with a 403 Forbidden status code.

    @see: L{twisted.web.pages.errorPage}

    @param brief: A short string displayed as the page title.

    @param brief: A longer string displayed in the page body.

    @returns: An L{IResource}
    )r   r   	FORBIDDENr6   r   r   r   r   x   s   r   N)r1   r2   )r7   r8   )r+   __all__typingr   twisted.webr   twisted.web.iwebr   r   twisted.web.resourcer	   r
   twisted.web.templater   r   r   r,   r-   r   r   r   r   r   r   r   <module>   s4   8
