Current File : //proc/self/root/lib/python3/dist-packages/twisted/web/__pycache__/_template_util.cpython-312.pyc
�

Ϫ�f{����dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZmZddlmZmZddlmZdd	lmZdd
lmZddl m!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/m0Z0ddl1m2Z2m3Z3m4Z4m5Z5ddl6m7Z7m8Z8m9Z9d�Z:de;de8de;fd�Z<Gd�de)jz�Z>Gd�de>�Z?Gd�de)jz�Z@Gd�d e)jz�ZAGd!�d"e+�ZBGd#�d$e+�ZCGd%�d&e+�ZDGd'�d(e+�ZEGd)�d*�ZFd+ZGGd,�d-ej�ej��ZJd.ee	eeKfded/fd0�ZLee9�Gd1�d2��ZMGd3�d4e+�ZNd5�ZOd6ZPe�ZQee9�Gd7�d8��ZRee9�Gd9�d:��ZShd;�ZTGd<�d=�ZUeU�ZV		dCde8d>e7d?ee;d@eee#gdAfdeWf
dB�ZXy)DzG
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)�AttributesNSImpl�Locator)�implementer)�Deferred)�Logger)�urlpath)�Failure)�FilePath)�fullyQualifiedName)�resource)�Element�renderer)�Flattenable�flatten�
flattenString)�CDATA�Comment�Tag�slot)�IRenderable�IRequest�ITemplateLoaderc� �dt|��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)�texts �</usr/lib/python3/dist-packages/twisted/web/_template_util.py�_PREr,,s���6�$�<�.��'�'��URL�request�returnc���t|t�std��|jdd�|j	|�ddt|j
d��jd�iz}|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/�contents   r+�
redirectTor;;sq��(�c�5�!��+�,�,����o�'B�C����S��	�	��s�z�z�'�*�+�2�2�7�;���G��Nr-c�8��eZdZdZdZdef�fd�Zd�Zd�Z�xZ	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�urlc�0��t�|��||_y�N)�super�__init__r>)�selfr>�	__class__s  �r+rBzRedirect.__init__ns���
������r-c�.�t|j|�Sr@)r;r>)rCr/s  r+�renderzRedirect.renderrs���$�(�(�G�,�,r-c��|Sr@��rC�namer/s   r+�getChildzRedirect.getChildu����r-)
�__name__�
__module__�__qualname__�__doc__�isLeafr4rBrFrK�
__classcell__)rDs@r+r=r=ds%�����F��E��-�r-r=c��eZdZdZd�Zd�Zy)�ChildRedirectorFc��|jd�dk(r0|jd�s|jd�std|z��tj	||�y)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�
ValueErrorr=rB)rCr>s  r+rBzChildRedirector.__init__}s[���X�X�e�_��
"��^�^�D�)��^�^�C�(��R��	��
�	���$��$r-c�f�|j}|jd�s|dz
}||z
}t|�S)NrW)r>�endswithrT)rCrJr/�newUrls    r+rKzChildRedirector.getChild�s4���������s�#��c�M�F��$����v�&�&r-N)rMrNrOrQrBrKrHr-r+rTrTzs��
�F�%� 'r-rTc�$�eZdZdZdZdedefd�Zy)�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/r0c��ttjj|�j	��jd�}t
||�S)zN
        Respond to all requests by redirecting to nearest directory.
        �ascii)�strr�URLPath�fromRequest�herer9r;)rCr/rfs   r+rFzParentRedirect.render�s>���7�?�?�.�.�w�7�<�<�>�?�F�F�w�O���$��(�(r-N)rMrNrOrPrQr'r4rFrHr-r+r_r_�s!���$�F�)�h�)�5�)r-r_c�2�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	y)	�DeferredResourcezT
    I wrap up a Deferred that will eventually result in a Resource
    object.
    r`c�P�tjj|�||_yr@)r�ResourcerB�d)rCrks  r+rBzDeferredResource.__init__�s�����"�"�4�(���r-c��|Sr@rHrIs   r+rKzDeferredResource.getChild�rLr-c��|jj|j|�j|j|�ddlm}|S)Nr)�NOT_DONE_YET)rk�addCallback�_cbChild�
addErrback�_ebChild�twisted.web.serverrn)rCr/rns   r+rFzDeferredResource.render�s4�������4�=�=�'�2�=�=�d�m�m�W�U�3��r-c�N�|jtj||��yr@)rFr�getChildForRequest)rC�childr/s   r+rpzDeferredResource._cbChild�s�����x�2�2�5�'�B�Cr-c�&�|j|�yr@)�processingFailed)rC�reasonr/s   r+rrzDeferredResource._ebChild�s��� � ��(r-N)
rMrNrOrPrQrBrKrFrprrrHr-r+rhrh�s(���
�F����D�)r-rhc�6�eZdZdZd�Zed��Zed��Zy)�_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.
    c�L�tj||�||_||_yr@)rrB�number�source)rC�loaderr}r~s    r+rBz_SourceLineElement.__init__�s ������v�&������r-c�F�||jjdd��S)zA
        Render the line of source as a child of C{tag}.
        z  u  )r~�replace�rCr/�tags   r+�
sourceLinez_SourceLineElement.sourceLine�s!��
�4�;�;�&�&�t�-B�C�D�Dr-c�8�|t|j��S)z>
        Render the line number as a child of C{tag}.
        )rcr}r�s   r+�
lineNumberz_SourceLineElement.lineNumber�s��
�3�t�{�{�#�$�$r-N)rMrNrOrPrBrr�r�rHr-r+r{r{�s6����
�E��E��%��%r-r{c�,�eZdZdZd�Zd�Zed��Zy)�_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.
    c�>�tj||�||_yr@�rrB�frame�rCrr�s   r+rBz_SourceFragmentElement.__init__��������v�&���
r-c#��K�|jd}|jd}t|dz
|dz�D]*}|tj||�j	�f���,y�w)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.
        r`�N)r��range�	linecache�getline�rstrip)rC�filenamer��snipLineNumbers    r+�_getSourceLinesz&_SourceFragmentElement._getSourceLines�sc�����:�:�a�=���Z�Z��]�
�#�J��N�J��N�C�	Y�N�!�9�#4�#4�X�~�#N�#U�#U�#W�X�X�	Y�s�AA!c	#��K�|j�D]N\}}|j�}||jdk(rd}nd}t|did|i���}t	|||����Py�w)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"}.
        r��snippetHighlightLine�snippetLine�classNrH)r��cloner��	TagLoaderr{)rCr/r�r�r��newTag�cssClassrs        r+�sourceLinesz"_SourceFragmentElement.sourceLinessr����'+�&:�&:�&<�	E�"�J�
��Y�Y�[�F��T�Z�Z��]�*�1��(���v�<��(�(;�<�=�F�$�V�Z��D�D�	E�s�A#A%N)rMrNrOrPrBr�rr�rHr-r+r�r��s(����Y��E��Er-r�c�V�eZdZdZd�Zed��Zed��Zed��Zed��Z	y)�
_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.
    c�>�tj||�||_yr@r�r�s   r+rBz_FrameElement.__init__%r�r-c�,�||jd�S)zY
        Render the name of the file this frame references as a child of C{tag}.
        r`�r�r�s   r+r�z_FrameElement.filename)���
�4�:�:�a�=�!�!r-c�>�|t|jd��S)zc
        Render the source line number this frame references as a child of
        C{tag}.
        r�)rcr�r�s   r+r�z_FrameElement.lineNumber0s���3�t�z�z�!�}�%�&�&r-c�,�||jd�S)zV
        Render the function name this frame references as a child of C{tag}.
        rr�r�s   r+�functionz_FrameElement.function8r�r-c�@�tt|�|j�S)zn
        Render the source code surrounding the line this frame references,
        replacing C{tag}.
        )r�r�r�r�s   r+r~z_FrameElement.source?s��&�i��n�d�j�j�A�Ar-N)
rMrNrOrPrBrr�r�r�r~rHr-r+r�r�s^�����"��"��'��'��"��"��B��Br-r�c�&�eZdZdZd�Zed��Zy)�
_StackElementzW
    L{_StackElement} renders an L{IRenderable} which can render a list of frames.
    c�>�tj||�||_yr@)rrB�stackFrames)rCrr�s   r+rBz_StackElement.__init__Ms������v�&�&��r-c	��|jD�cgc]%}tt|j��|���'c}Scc}w)zW
        Render the list of frames in this L{_StackElement}, replacing C{tag}.
        )r�r�r�r�)rCr/r�r�s    r+�framesz_StackElement.framesQs;��GK�FV�FV�
�=B�M�)�C�I�I�K�0�%�8�
�	
��
s�*<N)rMrNrOrPrBrr�rHr-r+r�r�Hs ���'��
��
r-r�c��eZdZdZddedfd�Zddeedeedeefd�Zdeed	eeddfd
�Zdeedeefd�Z	y)
�
_NSContextzL
    A mapping from XML namespaces onto their prefixes in the document.
    N�parentc�^�||_|�t|j�|_yddi|_y)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)rCr�s  r+rBz_NSContext.__init__`s-��
�����;F�v�z�z�;R�D�H�>��F�D�Hr-�krkr0c�:�|jj||�S)z\
        Get a prefix for a namespace.

        @param d: The default prefix value.
        )r��get)rCr�rks   r+r�z_NSContext.getks���x�x�|�|�A�q�!�!r-�vc�<�|jj||�y)zH
        Proxy through to setting the prefix for the namespace.
        N)r��__setitem__)rCr�r�s   r+r�z_NSContext.__setitem__ss��	
�����Q��"r-c�8�|jj|�S)zH
        Proxy through to getting the prefix for the namespace.
        )r��__getitem__)rCr�s  r+r�z_NSContext.__getitem__ys���x�x�#�#�A�&�&r-r@)
rMrNrOrPr
rBrcr�r�r�rHr-r+r�r�[s}���	G�x��5�	G�"�X�c�]�"�x��}�"���
�"�#�X�c�]�#�x��}�#��#�'�X�c�]�'�x��}�'r-r�z4http://twistedmatrix.com/ns/twisted.web.template/0.1c�*�eZdZdZdeefd�Zdeddfd�Zd"d�Z	d"d	�Z
d
ededdfd�Zd
eededdfd�Zd
eeddfd�Z
deeefdeededdfd�Zdeddfd�Zdeeefdeeddfd�Zdedededdfd�Zdeddfd�Zd"d�Zd"d�Zd eddfd!�Zy)#�_ToStanzd
    A SAX parser which converts an XML document to the Twisted STAN
    Document Object Model.
    �sourceFilenamec�>�||_t�|_d|_y)zP
        @param sourceFilename: the filename the XML was loaded out of.
        FN)r�r��	prefixMap�inCDATA)rCr�s  r+rBz_ToStan.__init__�s��-���#������r-�locatorr0Nc��||_y)zY
        Set the document locator, which knows about line and character numbers.
        N)r�)rCr�s  r+�setDocumentLocatorz_ToStan.setDocumentLocator�s����r-c�P�g|_|j|_g|_g|_y)z*
        Initialise the document.
        N)�document�current�stack�
xmlnsAttrs�rCs r+�
startDocumentz_ToStan.startDocument�s$��$&��
��}�}��� "��
�13��r-c��y)z!
        Document ended.
        NrHr�s r+�endDocumentz_ToStan.endDocument���r-�target�datac��y)z6
        Processing instructions are ignored.
        NrH)rCr�r�s   r+�processingInstructionz_ToStan.processingInstruction�r�r-�prefix�uric���t|j�|_||j|<|tk(ry|�|jj	d|f�y|jj	d|z|f�y)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)rCr�r�s   r+�startPrefixMappingz_ToStan.startPrefixMapping�si��$�D�N�N�3���$����s���$�$���>��O�O�"�"�G�S�>�2��O�O�"�"�J��$7��#=�>r-c�P�|jj}|�Jd��||_y)zb
        "Pops the stack" on the prefix mapping.

        Gets called after endElementNS.
        Nz$More prefix mapping ends than starts)r�r�)rCr�r�s   r+�endPrefixMappingz_ToStan.endPrefixMapping�s,�����&�&���!�I�#I�I�!���r-�namespaceAndName�qname�attrsc���|j}|jj�}|jj�}|\}}|tk(rn|dk(rd}nf|dk(ra	|d}	t
|d|	|||��}
|jj|
�|jj|
�|
j|_	yd}t|�}t|j��D]\}
}|
\}}|tk7r�|dk(s�|}||
=�!t�}|j�D]4\\}}}|jj|�}|�|}n|�d	|��}|||<�6|tk(r�|d
k(r�|jst!dt�d���d
|vrt!dt�d���t#d||||��}||jdj$|d
<|jj|�|j|_	y|j&r+|j)t|j&��g|_|tk7r'|�%|j|}|�|j|�d	|��}t#|tt+t,t.t0t2ft2f|��||||��}|jj|�|jj|�|j|_	y#t
$rd}	Y���wxYw)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)NrJ)r�r�r��columnNumberrF�:�attrz<{z}attr> as top-level elementrJz }attr> requires a name attribute)rFr�r�r�rV)�
attributesrFr�r�r�)r�r��
getLineNumber�getColumnNumberr��KeyErrorr%r�r�r��childrenr�list�itemsr�r��AssertionErrorr$r�r��updaterrrr4rc)rCr�r�r�r�r�r��nsrJr��slrF�orderedr�r��attrNS�justTheName�nonTemplateAttrs�attrNs�attrName�nsPrefix�attrKey�elr�s                        r+�startElementNSz_ToStan.startElementNS�s�� �&�&���\�\�/�/�1�
��|�|�3�3�5��#���D�
�#�#��}�$������#�#�$5�6�G�
��.�)�#�%�)�!-����
�
�!�!�"�%����#�#�B�'�!�{�{�������e�$�������)�	�D�A�q�"#��F�K��+�+���h�&����A�J�
	�'�=��%,�]�]�_�	*�!��V�X���~�~�)�)�&�1�H���"��%�J�a��z�2��()��W�%�
	*��#�#�����:�:�$��,�-�-I�J����-�-�$��,�-�-N�O������!�%�)��B�CE�D�J�J�r�N�%�%�&6�v�&>�?��J�J���b�!��;�;�D�L���?�?��#�#�K����$@�A� �D�O��#�#����^�^�B�'�F��!��.�.��,�-�Q�t�f�5��
��"��W�U�5�#�:�.��3�4�6F�G����!�%�	
��	
�
�
���"�������B���{�{����s �#�#�G�#�s�K'�'K6�5K6�chc��|jr|jdj|�y|jj|�y)zm
        Called when we receive some characters.  CDATA characters get passed
        through as is.
        rVN)r�r�r�r�)rCr�s  r+�
charactersz_ToStan.charactersEs6��
�<�<��J�J�r�N�!�!�"�%�������B�r-rJc��|jj�|jr|jdj|_y|j|_y)z�
        A namespace tag is closed.  Pop the stack, if there's anything left in
        it, otherwise return to the document's namespace.
        rVN)r��popr�r�r�)rCrJr�s   r+�endElementNSz_ToStan.endElementNSOs9��
	
�
�
�����:�:��:�:�b�>�2�2�D�L��=�=�D�Lr-�publicId�systemIdc��y�z#
        DTDs are ignored.
        NrH)rCrJrrs    r+�startDTDz_ToStan.startDTDZr�r-�argsc��yrrH)rCrs  r+�endDTDz_ToStan.endDTD_r�r-c�H�d|_|jjg�y)zO
        We're starting to be in a CDATA element, make a note of this.
        TN)r�r�r�r�s r+�
startCDATAz_ToStan.startCDATAds������
�
���"�r-c��d|_dj|jj��}|jjt
|��y)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�rr�r�r")rC�comments  r+�endCDATAz_ToStan.endCDATAks:��
����'�'�$�*�*�.�.�*�+�������E�'�N�+r-r:c�L�|jjt|��y)z=
        Add an XML comment which we've encountered.
        N)r�r�r#)rCr:s  r+rz_ToStan.commentts��	
�����G�G�,�-r-)r0N)rMrNrOrPr
rcrBrr�r�r�r�r�r�rrr�r�rr�objectr
rrrrHr-r+r�r��sJ���
�x��}���'��d��
4��
�C��s��t��
?��#��?�S�?�T�?�, �x��}� �� �v#���S��/�v#���}�v#� �	v#�

�v#�p �S� �T� �	)��s�C�x��	)��#��	)�4�	)��S��C��3��4��
�F��t��
�,�.�s�.�t�.r-r��flrc��t�}|jtjd�|jtjd�|jtj
d�|jtjd�tt|dd��}|j|�|j|�|jtj|�|j|�|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.
    rr`rJN)r�
setFeaturer�feature_validation�feature_namespaces�feature_external_ges�feature_external_pesr��getattr�setContentHandler�setEntityResolver�setProperty�property_lexical_handler�parser�)r�parser�ss   r+�
_flatsaxParser"{s����]�F�
���g�0�0�!�4�
���g�0�0�!�4�
���g�2�2�A�6�
���g�2�2�A�6����F�D�)�*�A�
���Q��
���Q��
���w�7�7��;�
�L�L����:�:�r-c�8�eZdZdZdeeeffd�Zdedfd�Z	y)�	XMLStringzH
    An L{ITemplateLoader} that loads and parses XML from a string.
    r!c��t|t�s|jd�}tt	j
|��|_y)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)r3rcr8r"�io�StringIO�_loadedTemplate)rCr!s  r+rBzXMLString.__init__�s4���!�S�!����� �A�4A�"�+�+�a�.�4Q���"r-r0rc��|jS)zM
        Return the document.

        @return: the loaded document.
        )r)r�s r+�loadzXMLString.load�s���#�#�#r-N)
rMrNrOrPrrcr4rBrr+rHr-r+r$r$�s-���#�%��U�
�+�#�$�d�=�)�$r-r$c�X�eZdZdZed�Zdd�Zed��Zed��Z	ed��Z
y)	�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>
Nc�>�tj||�||_yr@)rrB�failure)rCr/rs   r+rBzFailureElement.__init__s������v�&���r-c�L�|t|jj��S)zA
        Render the exception type as a child of C{tag}.
        )rr/�typer�s   r+r1zFailureElement.types��
�%�d�l�l�&7�&7�8�9�9r-c�j�|t|jj�jd��S)zB
        Render the exception value as a child of C{tag}.
        r&)rcr/�valuer9r�s   r+r3zFailureElement.values)��
�3�t�|�|�)�)�*�1�1�&�9�:�:r-c�T�tt|�|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�r�s   r+�	tracebackzFailureElement.tracebacks���Y�s�^�T�\�\�-@�-@�A�Ar-r@)rMrNrOrPr$rrBrr1r3r5rHr-r+r-r-�s^����I	�K�F�Z��:��:��;��;��B��Br-r-c��g}tdt|��j|j�t	|dt
�r$|dj
d�jdd�S|dj�y)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.
    Nrr2rb�xmlcharrefreplace)	r!r-�addBothr�r3r4r8r9�raiseException)�	myFailure�results  r+�
formatFailurer<#sj���F��$��y�1�2�:�:�6�=�=�I��&��)�U�#��a�y����(�/�/��9L�M�M�
�1�I���r-r`c�*�eZdZdZdd�Zdedfd�Zy)r�zJ
    An L{ITemplateLoader} that loads an existing flattenable object.
    rc��||_y)z>
        @param tag: The object which will be loaded.
        N�r�)rCr�s  r+rBzTagLoader.__init__Is��
#&���.r-r0c��|jgSr@r?r�s r+r+zTagLoader.loadQs�����z�r-N)r�r)rMrNrOrPrBrr+rHr-r+r�r�Cs���/��d�=�)�r-r�c�R�eZdZdZdeefd�Zdedfd�Zde	fd�Z
dedfd�Zy	)
�XMLFilezF
    An L{ITemplateLoader} that loads and parses XML from a file.
    �pathc�z�t|t�stjdtd��d|_	||_y)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.r�)�category�
stacklevelN)r3r�warnings�warn�DeprecationWarningr)�_path)rCrCs  r+rBzXMLFile.__init__[s>���$��)��M�M�@�+��	
�?C���=�$(��
�1r-r0rc���t|jt�st|j�S|jj	d�5}t|�cddd�S#1swYyxYw)zP
        Read and parse the XML.

        @return: the loaded document.
        �rN)r3rJrr"�open)rC�fs  r+�_loadDoczXMLFile._loadDocosP���$�*�*�h�/� ����,�,�������%�
(��$�Q�'�
(�
(�
(�s�A � A)c�"�d|j�d�S)Nz<XMLFile of �>)rJr�s r+�__repr__zXMLFile.__repr__{s���d�j�j�^�1�-�-r-c�\�|j�|j�|_|jS)zl
        Return the document, first loading it if necessary.

        @return: the loaded document.
        )r)rOr�s r+r+zXMLFile.load~s*�����'�#'�=�=�?�D� ��#�#�#r-N)rMrNrOrPrrrBrrOrcrRr+rHr-r+rBrBUsE���2�X�c�]�2�(
(�$�}�-�
(�.�#�.�$�d�=�)�$r-rB>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�embedr��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�selectr~�strike�strong�acronym�address�article�caption�command�details�isindex�section�summary�basefont�colgroup�datalist�fieldset�frameset�noframes�noscript�optgroup�progress�textarea�
blockquote�
figcaptionc� �eZdZdZdedefd�Zy)�_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.template
    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}
    �tagNamer0c��|dk(rtd�S|jd�}|tvrtd|����t|�S)Nr�r��_zunknown tag )r$r��VALID_HTML_TAG_NAMES�AttributeError)rCr�s  r+�__getattr__z_TagFactory.__getattr__sF���m�#��r�7�N��.�.��%���.�.� �<��{�!;�<�<��7�|�r-N)rMrNrOrPrcr$r�rHr-r+r�r�	s����3��3�r-r��element�doctype�_failElementrc�H���|�"�j|��jd���t�t�|�j�}dtdtt
df��fd�}�d�dtdtdtfd	�}|j|�|j|�tS)
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/r0c����tjd|��t�dd�}|�-|jr!��J�t	��|��j
�S�jd�y)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/s  ��r+�ebzrenderElement.<locals>.ebAst������=�w�	�	
��w���-����� 6� 6��+�+�+��7�L��$9�7�=�=�I�I��M�M�K�
�r-)r/r;r/c�&�|j�|Sr@)�finish)r;r/s  r+r�zrenderElement.<locals>.finishRs�������
r-)r�r-r rr
rrr'rqr8rn)r/r�r�r�rkr�r�s`  `   r+�
renderElementr�$s����(���
�
�g���
�
�e����%�����'�-�-�0�A��G����$�� 8��"7>��v��8��&���L�L����I�I�f���r-)s<!DOCTYPE html>N)YrPr'r�rG�collectionsrr�r�typingrrrr	r
rrr
rrr�xml.saxrr�xml.sax.xmlreaderrr�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._flattenrr r!�twisted.web._stanr"r#r$r%�twisted.web.iwebr&r'r(r,r4r;rjr=rTr_rhr{r�r�r�r�r��ContentHandler�EntityResolverr�rcr"r$r-r<rnr�r�rBr�r��tagsrr�rHr-r+�<module>r�s>���
���#������)�7�&�+�!�"�*�,�5� �2�D�D�7�7�C�C�(�&�E�&�H�&��&�R�x� � ��,'�h�'�6)�X�&�&�)�:)�x�(�(�)�8%��%�<+E�W�+E�\+B�G�+B�\
�G�
�&"'�"'�JL��u.�g�$�$�g�&<�&<�u.�p�e�B�v�J��O�,���m�1D��0
�_��$�$��$�6qB�W�qB�h�8��
�X�
�
�_������"
�_��0$�0$��0$�ny��x��0�}�� 2�=A�	4�
�4�
�4��e�_�4��8�W�I�y�$8�9�:�	4�
�4r-
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!