Your IP : 216.73.216.213
B
;��]�! � @ s d Z ddlmZ ddlmZ ddlmZmZmZ e e G dd� de �Z
dd� Zd9d
d�Zdd
� Z
dd� Zdd� Zdd� Zd:dd�Zdd� Zdd� Zdd� Zd;dd�ZG d d!� d!ej�Zd<d#d$�Zd=d%d&�Zd>d'd(�Zd)d*� Zd+d,� Zd?d-d.�Zd/d0� Zd1d2� Zd3d4� Z d5d6� Z!d7d8� Z"d"S )@z>
A library for performing interesting tasks with DOM objects.
� )�StringIO)�microdom)�getElementsByTagName�escape�unescapec @ s e Zd ZdS )�NodeLookupErrorN)�__name__�
__module__�__qualname__� r r �I/opt/alt/python37/lib64/python3.7/site-packages/twisted/web/domhelpers.pyr s r c C sJ xD|j D ]:}t|d�r6|jr6|�dt|j�|j| � t| ||� qW dS )z�
Look through the given node's children for strings, and
attempt to do string substitution with the given parameter.
� nodeValuer N)�
childNodes�hasattrr
ZreplaceData�len�
substitute)Zrequest�node�subs�childr r r r s r ��id�class�model�patternc C s� t | d�r6| �� r6x"|D ]}t| �|��|kr| S qW | �� r�t | jd�rT| jj}n
t| j�}x(t|�D ]}t | j| |�}|rh|S qhW dS )zx
(internal) Get a node with the specified C{nodeId} as any of the C{class},
C{id} or C{pattern} attributes.
�
hasAttributes�lengthN)
r r �str�getAttribute�
hasChildNodesr r r �range�_get)r �nodeIdZ nodeAttrsZnodeAttrr ZchildNum�resultr r r r ! s
r c C s t | |�}|r|S t|��dS )z�
Get a node with the specified C{nodeId} as any of the C{class},
C{id} or C{pattern} attributes. If there is no such node, raise
L{NodeLookupError}.
N)r r )r r! r"