
    h                         S r SrSSKJr  SSKJr  SSKJrJr  SSK	J
r
Jr  SSKJrJr   " S S	\5      rS
\S\S\S\4S jr  SS\S\S\
4S jjr SS\S\S\
4S jjrg)z*
Utility implementations of L{IResource}.
)	errorPagenotFound	forbidden    )cast)http)IRenderableIRequest)	IResourceResource)renderElementtagsc                   h   ^  \ rS rSrSrS\S\S\SS4U 4S jjrS	\S\	4S
 jr
S\S	\S\4S jrSrU =r$ )
_ErrorPage   a  
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                 F   > [         TU ]  5         Xl        X l        X0l        g )N)super__init___code_brief_detail)selfr   r   r   	__class__s       X/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/web/pages.pyr   _ErrorPage.__init__(   s    
 "    requestc                    UR                  U R                  5        UR                  SS5        [        U[	        [
        [        R                  " [        R                  " [        R                  " U R                   SU R                   35      5      [        R                  " [        R                  " U R                  5      [        R                  " U R                  5      5      5      5      5      $ )zr
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    s     r   render_ErrorPage.render.   s    
 	

+/+FG 		IIdjjDJJ<s4;;-)HIJIIdggdkk2DFF4<<4HI
 	
r   pathc                     U $ )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    s      r   getChild_ErrorPage.getChildC   s	     r   )r   r   r   )__name__
__module____qualname____firstlineno____doc__intstrr   r	   objectr*   bytesr   r/   __static_attributes____classcell__)r   s   @r   r   r      s[     #S # #c #d #
h 
6 
*	U 	X 	( 	 	r   r   r   r   r   r   c                     [        XU5      $ )aF  
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   s      r   r   r   O   s    ( d6**r   messagec                 6    [        [        R                  X5      $ )z
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 message: A longer string displayed in the page body.

@returns: An L{IResource}
)r   r   	NOT_FOUNDr   r=   s     r   r   r   f   s     dnne55r   c                 6    [        [        R                  X5      $ )z
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 message: A longer string displayed in the page body.

@returns: An L{IResource}
)r   r   	FORBIDDENr@   s     r   r   r   x   s     dnne55r   N)zNo Such Resourcez%Sorry. No luck finding that resource.)zForbidden ResourcezSorry, resource is forbidden.)r5   __all__typingr   twisted.webr   twisted.web.iwebr   r	   twisted.web.resourcer
   r   twisted.web.templater   r   r   r6   r7   r   r   r   r.   r   r   <module>rI      s   
   2 4 45 5p+C + +S +Z +0 $:666 6& 7V660366r   