AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/web/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/web/__pycache__/_template_util.cpython-310.pyc
o

5�@g{�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZmZddlmZddlmZdd	lmZdd
lmZddlm Z ddl!m"Z"dd
l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+ddl,m-Z-m.Z.m/Z/ddl0m1Z1m2Z2m3Z3m4Z4ddl5m6Z6m7Z7m8Z8dd�Z9de:de7de:fdd�Z;Gdd�de(j<�Z=Gdd�de=�Z>Gdd �d e(j<�Z?Gd!d"�d"e(j<�Z@Gd#d$�d$e*�ZAGd%d&�d&e*�ZBGd'd(�d(e*�ZCGd)d*�d*e*�ZDGd+d,�d,�ZEd-ZFGd.d/�d/ejGejH�ZId0ee	eeJfded1fd2d3�ZKee8�Gd4d5�d5��ZLGd6d7�d7e*�ZMd8d9�ZNd:ZOe�ZPee8�Gd;d<�d<��ZQee8�Gd=d>�d>��ZRhd?�ZSGd@dA�dA�ZTeT�ZU	B	dIde7dCe6dDee:dEeee"gdFfdeVf
dGdH�ZWdS)JzG
twisted.web.util and twisted.web.template merged to avoid cyclic deps
�N)�OrderedDict��escape)�IO�Any�AnyStr�Callable�Dict�List�Mapping�Optional�Tuple�Union�cast)�handler�make_parser)�Locator)�implementer)�Deferred)�Logger)�urlpath)�Failure)�FilePath)�fullyQualifiedName)�resource)�Element�renderer)�Flattenable�flatten�
flattenString)�CDATA�Comment�Tag�slot)�IRenderable�IRequest�ITemplateLoadercCsdt|��d�S)aK
    Wraps <pre> tags around some text and HTML-escape it.

    This is here since once twisted.web.html was deprecated it was hard to
    migrate the html.PRE from current code to twisted.web.template.

    For new code consider using twisted.web.template.

    @return: Escaped text wrapped in <pre> tags.
    @rtype: C{str}
    z<pre>z</pre>r)�text�r(�</usr/lib/python3/dist-packages/twisted/web/_template_util.py�_PRE,sr*�URL�request�returncCsHt|t�s	td��|�dd�|�|�ddt|�d���d�i}|S)a�
    Generate a redirect to the given location.

    @param URL: A L{bytes} giving the location to which to redirect.

    @param request: The request object to use to generate the redirect.
    @type request: L{IRequest<twisted.web.iweb.IRequest>} provider

    @raise TypeError: If the type of C{URL} a L{str} instead of L{bytes}.

    @return: A L{bytes} containing HTML which tries to convince the client
        agent
        to visit the new location even if it doesn't respect the I{FOUND}
        response code.  This is intended to be returned from a render method,
        eg::

            def render_GET(self, request):
                return redirectTo(b"http://example.com/", request)
    zURL must be bytessContent-Typestext/html; charset=utf-8s�
<html>
    <head>
        <meta http-equiv="refresh" content="0;URL=%(url)s">
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <a href="%(url)s">click here</a>
    </body>
</html>
surl�utf-8)�
isinstance�bytes�	TypeError�	setHeader�redirectr�decode�encode)r+r,�contentr(r(r)�
redirectTo;s


��r7cs:eZdZdZdZdef�fdd�Zdd�Zdd	�Z�Z	S)
�Redirectz�
    Resource that redirects to a specific URL.

    @ivar url: Redirect target URL to put in the I{Location} response header.
    @type url: L{bytes}
    T�urlcst���||_dS�N)�super�__init__r9��selfr9��	__class__r(r)r<ns

zRedirect.__init__cCst|j|�Sr:)r7r9)r>r,r(r(r)�renderrszRedirect.rendercC�|Sr:r(�r>�namer,r(r(r)�getChildu�zRedirect.getChild)
�__name__�
__module__�__qualname__�__doc__�isLeafr0r<rArE�
__classcell__r(r(r?r)r8dsr8c@s eZdZdZdd�Zdd�ZdS)�ChildRedirectorFcCs>|�d�dkr|�d�s|�d�std|��t�||�dS)Nz://���z..�/zvIt seems you've given me a redirect (%s) that is a child of myself! That's not good, it'll cause an infinite redirect.)�find�
startswith�
ValueErrorr8r<r=r(r(r)r<}s����zChildRedirector.__init__cCs(|j}|�d�s|d7}||7}t|�S)NrO)r9�endswithrM)r>rDr,�newUrlr(r(r)rE�s

zChildRedirector.getChildN)rGrHrIrKr<rEr(r(r(r)rMzsrMc@s&eZdZdZdZdedefdd�ZdS)�ParentRedirectu�
    Redirect to the nearest directory and strip any query string.

    This generates redirects like::

        /              →  /
        /foo           →  /
        /foo?bar       →  /
        /foo/          →  /foo/
        /foo/bar       →  /foo/
        /foo/bar?baz   →  /foo/

    However, the generated I{Location} header contains an absolute URL rather
    than a path.

    The response is the same regardless of HTTP method.
    �r,r-cCs$ttj�|�����d�}t||�S)zN
        Respond to all requests by redirecting to nearest directory.
        �ascii)�strr�URLPath�fromRequest�herer5r7)r>r,r[r(r(r)rA�s
zParentRedirect.renderN)rGrHrIrJrKr%r0rAr(r(r(r)rU�srUc@s<eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S)�DeferredResourcezT
    I wrap up a Deferred that will eventually result in a Resource
    object.
    rVcCstj�|�||_dSr:)r�Resourcer<�d)r>r^r(r(r)r<��
zDeferredResource.__init__cCrBr:r(rCr(r(r)rE�rFzDeferredResource.getChildcCs*|j�|j|��|j|�ddlm}|S)Nr)�NOT_DONE_YET)r^�addCallback�_cbChild�
addErrback�_ebChild�twisted.web.serverr`)r>r,r`r(r(r)rA�szDeferredResource.rendercCs|�t�||��dSr:)rAr�getChildForRequest)r>�childr,r(r(r)rb�szDeferredResource._cbChildcCs|�|�dSr:)�processingFailed)r>�reasonr,r(r(r)rd��zDeferredResource._ebChildN)
rGrHrIrJrKr<rErArbrdr(r(r(r)r\�sr\c@s0eZdZdZdd�Zedd��Zedd��ZdS)	�_SourceLineElementa
    L{_SourceLineElement} is an L{IRenderable} which can render a single line of
    source code.

    @ivar number: A C{int} giving the line number of the source code to be
        rendered.
    @ivar source: A C{str} giving the source code to be rendered.
    cCst�||�||_||_dSr:)rr<�number�source)r>�loaderrlrmr(r(r)r<�s
z_SourceLineElement.__init__cCs||j�dd��S)zA
        Render the line of source as a child of C{tag}.
        z  u  )rm�replace�r>r,�tagr(r(r)�
sourceLine�sz_SourceLineElement.sourceLinecCs|t|j��S)z>
        Render the line number as a child of C{tag}.
        )rXrlrpr(r(r)�
lineNumber��z_SourceLineElement.lineNumberN)rGrHrIrJr<rrrrsr(r(r(r)rk�s	
rkc@s,eZdZdZdd�Zdd�Zedd��ZdS)	�_SourceFragmentElementa�
    L{_SourceFragmentElement} is an L{IRenderable} which can render several lines
    of source code near the line number of a particular frame object.

    @ivar frame: A L{Failure<twisted.python.failure.Failure>}-style frame object
        for which to load a source line to render.  This is really a tuple
        holding some information from a frame object.  See
        L{Failure.frames<twisted.python.failure.Failure>} for specifics.
    cC�t�||�||_dSr:�rr<�frame�r>rnrxr(r(r)r<�r_z_SourceFragmentElement.__init__ccsH�|jd}|jd}t|d|d�D]
}|t�||���fVqdS)a$
        Find the source line references by C{self.frame} and yield, in source
        line order, it and the previous and following lines.

        @return: A generator which yields two-tuples.  Each tuple gives a source
            line number and the contents of that source line.
        rV�N)rx�range�	linecache�getline�rstrip)r>�filenamers�snipLineNumberr(r(r)�_getSourceLines�s�

�z&_SourceFragmentElement._getSourceLinesccs\�|��D]&\}}|��}||jdkrd}nd}t|did|i���}t|||�VqdS)z�
        Render the source line indicated by C{self.frame} and several
        surrounding lines.  The active line will be given a I{class} of
        C{"snippetHighlightLine"}.  Other lines will be given a I{class} of
        C{"snippetLine"}.
        rz�snippetHighlightLine�snippetLine�classNr()r��clonerx�	TagLoaderrk)r>r,rqrsrr�newTag�cssClassrnr(r(r)�sourceLiness��z"_SourceFragmentElement.sourceLinesN)rGrHrIrJr<r�rr�r(r(r(r)ru�s

ruc@sHeZdZdZdd�Zedd��Zedd��Zedd	��Zed
d��Z	dS)
�
_FrameElementa�
    L{_FrameElement} is an L{IRenderable} which can render details about one
    frame from a L{Failure<twisted.python.failure.Failure>}.

    @ivar frame: A L{Failure<twisted.python.failure.Failure>}-style frame object
        for which to load a source line to render.  This is really a tuple
        holding some information from a frame object.  See
        L{Failure.frames<twisted.python.failure.Failure>} for specifics.
    cCrvr:rwryr(r(r)r<%r_z_FrameElement.__init__cC�||jd�S)zY
        Render the name of the file this frame references as a child of C{tag}.
        rV�rxrpr(r(r)r)rtz_FrameElement.filenamecCs|t|jd��S)zc
        Render the source line number this frame references as a child of
        C{tag}.
        rz)rXrxrpr(r(r)rs0sz_FrameElement.lineNumbercCr�)zV
        Render the function name this frame references as a child of C{tag}.
        rr�rpr(r(r)�function8rtz_FrameElement.functioncCstt|�|j�S)zn
        Render the source code surrounding the line this frame references,
        replacing C{tag}.
        )rur�rxrpr(r(r)rm?sz_FrameElement.sourceN)
rGrHrIrJr<rrrsr�rmr(r(r(r)r�s



r�c@s$eZdZdZdd�Zedd��ZdS)�
_StackElementzW
    L{_StackElement} renders an L{IRenderable} which can render a list of frames.
    cCrvr:)rr<�stackFrames)r>rnr�r(r(r)r<Mr_z_StackElement.__init__cs�fdd�|jD�S)zW
        Render the list of frames in this L{_StackElement}, replacing C{tag}.
        csg|]}tt����|��qSr()r�r�r�)�.0rx�rqr(r)�
<listcomp>Vs�z(_StackElement.frames.<locals>.<listcomp>)r�rpr(r�r)�framesQs
�z_StackElement.framesN)rGrHrIrJr<rr�r(r(r(r)r�Hs
r�c@s�eZdZdZddedfdd�Zddeedeedeefd	d
�Zdeedeeddfdd
�Zdeedeefdd�Z	dS)�
_NSContextzL
    A mapping from XML namespaces onto their prefixes in the document.
    N�parentcCs,||_|durt|j�|_dSddi|_dS)ze
        Pull out the parent's namespaces, if there's no parent then default to
        XML.
        Nz$http://www.w3.org/XML/1998/namespace�xml)r�r�nss)r>r�r(r(r)r<`sz_NSContext.__init__�kr^r-cCs|j�||�S)z\
        Get a prefix for a namespace.

        @param d: The default prefix value.
        )r��get)r>r�r^r(r(r)r�ksz_NSContext.get�vcCs|j�||�dS)zH
        Proxy through to setting the prefix for the namespace.
        N)r��__setitem__)r>r�r�r(r(r)r�ssz_NSContext.__setitem__cCs|j�|�S)zH
        Proxy through to getting the prefix for the namespace.
        )r��__getitem__)r>r�r(r(r)r�ysz_NSContext.__getitem__r:)
rGrHrIrJrr<rXr�r�r�r(r(r(r)r�[s$r�z4http://twistedmatrix.com/ns/twisted.web.template/0.1c	@sNeZdZdZdeefdd�Zdeddfdd	�Zd1d
d�Z	d1dd
�Z
dededdfdd�Zdeededdfdd�Zdeeddfdd�Z
deeefdeedeeeeefefddfdd�Zdeddfdd�Zd eeefdeeddfd!d"�Zd ed#ed$eddfd%d&�Zd'eddfd(d)�Zd1d*d+�Zd1d,d-�Zd.eddfd/d0�ZdS)2�_ToStanzd
    A SAX parser which converts an XML document to the Twisted STAN
    Document Object Model.
    �sourceFilenamecCs||_t�|_d|_dS)zP
        @param sourceFilename: the filename the XML was loaded out of.
        FN)r�r��	prefixMap�inCDATA)r>r�r(r(r)r<�s
z_ToStan.__init__�locatorr-NcC�
||_dS)zY
        Set the document locator, which knows about line and character numbers.
        N)r�)r>r�r(r(r)�setDocumentLocator�s
z_ToStan.setDocumentLocatorcCsg|_|j|_g|_g|_dS)z*
        Initialise the document.
        N)�document�current�stack�
xmlnsAttrs�r>r(r(r)�
startDocument�s
z_ToStan.startDocumentcC�dS)z!
        Document ended.
        Nr(r�r(r(r)�endDocument��z_ToStan.endDocument�target�datacCr�)z6
        Processing instructions are ignored.
        Nr()r>r�r�r(r(r)�processingInstruction�r�z_ToStan.processingInstruction�prefix�uricCsVt|j�|_||j|<|tkrdS|dur|j�d|f�dS|j�d||f�dS)z�
        Set up the prefix mapping, which maps fully qualified namespace URIs
        onto namespace prefixes.

        This gets called before startElementNS whenever an C{xmlns} attribute
        is seen.
        N�xmlnszxmlns:%s)r�r��TEMPLATE_NAMESPACEr��append)r>r�r�r(r(r)�startPrefixMapping�s	
z_ToStan.startPrefixMappingcCs"|jj}|dusJd��||_dS)zb
        "Pops the stack" on the prefix mapping.

        Gets called after endElementNS.
        Nz$More prefix mapping ends than starts)r�r�)r>r�r�r(r(r)�endPrefixMapping�s
z_ToStan.endPrefixMapping�namespaceAndName�qname�attrscCsP|j}|j��}|j��}|\}}|tkrO|dkrd}n3|dkrOz|d}	Wnty1d}	Ynwt|d|	|||d�}
|j�|
�|j	�|
�|
j
|_	dSd}t|�}t|�
��D]\}}
|\}}|tkrhq[|dkrq|
}||=q[t�}|�
�D]\\}}}
|j�|�}|dur�|}n|�d	|��}|
||<qy|tkr�|d
kr�|js�tdt�d���d
|vr�tdt�d���td||||d�}||jdj|d
<|j�|�|j
|_	dS|jr�|�t|j��g|_|tkr�|dur�|j|}|dur�|j|�d	|��}t|ttttttftf|��||||d�}|j�|�|j	�|�|j
|_	dS)a]
        Gets called when we encounter a new xmlns attribute.

        @param namespaceAndName: a (namespace, name) tuple, where name
            determines which type of action to take, if the namespace matches
            L{TEMPLATE_NAMESPACE}.
        @param qname: ignored.
        @param attrs: attributes on the element being started.
        �transparent�r#)N�defaultN)NrD)r�rrs�columnNumberrA�:�attrz<{z}attr> as top-level elementrDz }attr> requires a name attribute)rArrsr�rN)�
attributesrArrsr�)r�r��
getLineNumber�getColumnNumberr��KeyErrorr#r�r�r��childrenr�list�itemsr�r��AssertionErrorr"r�r��updaterrrr0rX)r>r�r�r�rrsr��nsrDr��slrAr�r��attrNS�justTheName�nonTemplateAttrs�attrNs�attrName�nsPrefix�attrKey�elr�r(r(r)�startElementNS�s�

���	

�
��
��
z_ToStan.startElementNS�chcCs*|jr
|jd�|�dS|j�|�dS)zm
        Called when we receive some characters.  CDATA characters get passed
        through as is.
        rNN)r�r�r�r�)r>r�r(r(r)�
charactersEsz_ToStan.charactersrDcCs.|j��|jr|jdj|_dS|j|_dS)z�
        A namespace tag is closed.  Pop the stack, if there's anything left in
        it, otherwise return to the document's namespace.
        rNN)r��popr�r�r�)r>rDr�r(r(r)�endElementNSOs
z_ToStan.endElementNS�publicId�systemIdcCr��z#
        DTDs are ignored.
        Nr()r>rDr�r�r(r(r)�startDTDZr�z_ToStan.startDTD�argscGr�r�r()r>r�r(r(r)�endDTD_r�z_ToStan.endDTDcCsd|_|j�g�dS)zO
        We're starting to be in a CDATA element, make a note of this.
        TN)r�r�r�r�r(r(r)�
startCDATAdsz_ToStan.startCDATAcCs*d|_d�|j���}|j�t|��dS)z�
        We're no longer in a CDATA element.  Collect up the characters we've
        parsed and put them in a new CDATA object.
        Fr�N)r��joinr�r�r�r�r )r>�commentr(r(r)�endCDATAksz_ToStan.endCDATAr6cCs|j�t|��dS)z=
        Add an XML comment which we've encountered.
        N)r�r�r!)r>r6r(r(r)r�tsz_ToStan.comment)r-N)rGrHrIrJrrXr<rr�r�r�r�r�r�r
rr�r�r�r��objectr�r�r�r�r(r(r(r)r��s2



���
�x"


	r��flrcCs�t�}|�tjd�|�tjd�|�tjd�|�tjd�tt|dd��}|�	|�|�
|�|�tj|�|�
|�|jS)z�
    Perform a SAX parse of an XML document with the _ToStan class.

    @param fl: The XML document to be parsed.

    @return: a C{list} of Stan objects.
    rrVrDN)r�
setFeaturer�feature_validation�feature_namespaces�feature_external_ges�feature_external_pesr��getattr�setContentHandler�setEntityResolver�setProperty�property_lexical_handler�parser�)r��parser�sr(r(r)�
_flatsaxParse{s


r�c@s8eZdZdZdeeeffdd�Zdedfdd�Z	d	S)
�	XMLStringzH
    An L{ITemplateLoader} that loads and parses XML from a string.
    r�cCs(t|t�s
|�d�}tt�|��|_dS)z�
        Run the parser on a L{io.StringIO} copy of the string.

        @param s: The string from which to load the XML.
        @type s: L{str}, or a UTF-8 encoded L{bytes}.
        �utf8N)r/rXr4r��io�StringIO�_loadedTemplate)r>r�r(r(r)r<�s

zXMLString.__init__r-rcCs|jS)zM
        Return the document.

        @return: the loaded document.
        )r�r�r(r(r)�load�szXMLString.loadN)
rGrHrIrJrrXr0r<r
r�r(r(r(r)r��s
r�c@sFeZdZdZed�Zddd�Zedd��Zedd	��Z	ed
d��Z
dS)
�FailureElementa
    L{FailureElement} is an L{IRenderable} which can render detailed information
    about a L{Failure<twisted.python.failure.Failure>}.

    @ivar failure: The L{Failure<twisted.python.failure.Failure>} instance which
        will be rendered.

    @since: 12.1
    ao
<div xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">
  <style type="text/css">
    div.error {
      color: red;
      font-family: Verdana, Arial, helvetica, sans-serif;
      font-weight: bold;
    }

    div {
      font-family: Verdana, Arial, helvetica, sans-serif;
    }

    div.stackTrace {
    }

    div.frame {
      padding: 1em;
      background: white;
      border-bottom: thin black dashed;
    }

    div.frame:first-child {
      padding: 1em;
      background: white;
      border-top: thin black dashed;
      border-bottom: thin black dashed;
    }

    div.location {
    }

    span.function {
      font-weight: bold;
      font-family: "Courier New", courier, monospace;
    }

    div.snippet {
      margin-bottom: 0.5em;
      margin-left: 1em;
      background: #FFFFDD;
    }

    div.snippetHighlightLine {
      color: red;
    }

    span.code {
      font-family: "Courier New", courier, monospace;
    }
  </style>

  <div class="error">
    <span t:render="type" />: <span t:render="value" />
  </div>
  <div class="stackTrace" t:render="traceback">
    <div class="frame" t:render="frames">
      <div class="location">
        <span t:render="filename" />:<span t:render="lineNumber" /> in
        <span class="function" t:render="function" />
      </div>
      <div class="snippet" t:render="source">
        <div t:render="sourceLines">
          <span class="lineno" t:render="lineNumber" />
          <code class="code" t:render="sourceLine" />
        </div>
      </div>
    </div>
  </div>
  <div class="error">
    <span t:render="type" />: <span t:render="value" />
  </div>
</div>
NcCst�||�||_dSr:)rr<�failure)r>r�rnr(r(r)r<r_zFailureElement.__init__cCs|t|jj��S)zA
        Render the exception type as a child of C{tag}.
        )rr��typerpr(r(r)r�szFailureElement.typecCs|t|jj��d��S)zB
        Render the exception value as a child of C{tag}.
        r�)rXr��valuer5rpr(r(r)r�szFailureElement.valuecCstt|�|jj�S)z�
        Render all the frames in the wrapped
        L{Failure<twisted.python.failure.Failure>}'s traceback stack, replacing
        C{tag}.
        )r�r�r�r�rpr(r(r)�	tracebackszFailureElement.tracebackr:)rGrHrIrJr�rnr<rr�r�r�r(r(r(r)r��s
�
M

r�cCsNg}tdt|���|j�t|dt�r|d�d��dd�S|d��dS)a
    Construct an HTML representation of the given failure.

    Consider using L{FailureElement} instead.

    @type myFailure: L{Failure<twisted.python.failure.Failure>}

    @rtype: L{bytes}
    @return: A string containing the HTML representation of the given failure.
    Nrr.rW�xmlcharrefreplace)	rr��addBothr�r/r0r4r5�raiseException)�	myFailure�resultr(r(r)�
formatFailure#s
rrVc@s,eZdZdZd
dd�Zdedfdd�Zd	S)r�zJ
    An L{ITemplateLoader} that loads an existing flattenable object.
    rqrcCr�)z>
        @param tag: The object which will be loaded.
        Nr�)r>rqr(r(r)r<IszTagLoader.__init__r-cCs|jgSr:r�r�r(r(r)r�QszTagLoader.loadN)rqr)rGrHrIrJr<r
r�r(r(r(r)r�Cs
r�c@sPeZdZdZdefdd�Zdedfdd�Zdefd	d
�Z	dedfdd�Z
d
S)�XMLFilezF
    An L{ITemplateLoader} that loads and parses XML from a file.
    �pathcCs,t|t�s
tjdtdd�d|_	||_dS)zf
        Run the parser on a file.

        @param path: The file from which to load the XML.
        zhPassing filenames or file objects to XMLFile is deprecated since Twisted 12.1.  Pass a FilePath instead.rz)�category�
stacklevelN)r/r�warnings�warn�DeprecationWarningr��_path)r>rr(r(r)r<[s
�zXMLFile.__init__r-rcCsNt|jt�st|j�S|j�d��}t|�Wd�S1s wYdS)zP
        Read and parse the XML.

        @return: the loaded document.
        �rN)r/r
rr��open)r>�fr(r(r)�_loadDocos

$�zXMLFile._loadDoccCsd|j�d�S)Nz<XMLFile of �>)r
r�r(r(r)�__repr__{rjzXMLFile.__repr__cCs|jdur
|��|_|jS)zl
        Return the document, first loading it if necessary.

        @return: the loaded document.
        N)r�rr�r(r(r)r�~s

zXMLFile.loadN)rGrHrIrJrr<r
rrXrr�r(r(r(r)rUsr>x�a�b�i�p�qr��u�br�dd�dl�dt�em�h1�h2�h3�h4�h5�h6�hr�li�ol�rp�rt�td�th�tr�tt�ul�bdi�bdo�big�col�del�dfn�dir�div�img�ins�kbd�map�nav�pre�sub�sup�var�wbr�abbr�area�base�body�cite�code�font�form�head�html�link�mark�menu�meta�ruby�samp�span�time�aside�audio�embedrx�input�label�meter�param�small�style�table�tbody�tfoot�thead�title�video�applet�button�canvas�center�figure�footer�header�hgroup�iframe�keygen�legendr��option�output�script�selectrm�strike�strong�acronym�address�article�caption�command�details�isindex�section�summary�basefont�colgroup�datalist�fieldset�frameset�noframes�noscript�optgroup�progress�textarea�
blockquote�
figcaptionc@s"eZdZdZdedefdd�ZdS)�_TagFactorya�
    A factory for L{Tag} objects; the implementation of the L{tags} object.

    This allows for the syntactic convenience of C{from twisted.web.html import
    tags; tags.a(href="linked-page.html")}, where 'a' can be basically any HTML
    tag.

    The class is not exposed publicly because you only ever need one of these,
    and we already made it for you.

    @see: L{tags}
    �tagNamer-cCs8|dkrtd�S|�d�}|tvrtd|����t|�S)Nr�r��_zunknown tag )r"r~�VALID_HTML_TAG_NAMES�AttributeError)r>r�r(r(r)�__getattr__s
z_TagFactory.__getattr__N)rGrHrIrJrXr"r�r(r(r(r)r�	s
r��<!DOCTYPE html>�element�doctype�_failElementrcs�|dur��|���d��durt�t�|�j�}dtdttdf��fdd�}�d�dtd	tdtfd
d�}|�|�|�	|�t
S)a�
    Render an element or other L{IRenderable}.

    @param request: The L{IRequest} being rendered to.
    @param element: An L{IRenderable} which will be rendered.
    @param doctype: A L{bytes} which will be written as the first line of
        the request, or L{None} to disable writing of a doctype.  The argument
        should not include a trailing newline and will default to the HTML5
        doctype C{'<!DOCTYPE html>'}.

    @returns: NOT_DONE_YET

    @since: 12.1
    N�
r�r-csTtjd|d�t�dd�}|dur#|jr#�dusJ�t��|��j�S��d�dS)Nz/An error occurred while rendering the response.)r��sitesr<div style="font-size:800%;background-color:#FFF;color:#F00">An error occurred while rendering the response.</div>)�
_moduleLogr�r��displayTracebacksr�write)r�r��r�r,r(r)�ebAs��zrenderElement.<locals>.eb)r,rr,cSs|��|Sr:)�finish)rr,r(r(r)r�RszrenderElement.<locals>.finish)r�r�rrrrr�r%rcr�r`)r,r�r�r�r^r�r�r(r�r)�
renderElement$s

 

r�)r�N)XrJr�r|r�collectionsrrGr�typingrrrrr	r
rrr
rr�xml.saxrr�xml.sax.xmlreaderr�zope.interfacer�twisted.internet.deferr�twisted.loggerr�twisted.pythonr�twisted.python.failurer�twisted.python.filepathr�twisted.python.reflectr�twisted.webr�twisted.web._elementrr�twisted.web._flattenrrr�twisted.web._stanr r!r"r#�twisted.web.iwebr$r%r&r*r0r7r]r8rMrUr\rkrur�r�r�r��ContentHandler�EntityResolverr�rXr�r�r�rr`r�r�rr�r��tagsr�r�r(r(r(r)�<module>s|4
)..%"yt7|������

Anon7 - 2022
AnonSec Team