403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.216.137.32
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/paste/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/paste/__pycache__/url.cpython-37.pyc
B

a�N 9�@s�dZddlZddlZddlmZdaddgZdd�Zdd	�Zej	Z
d
d�ZGdd
�d
e�Z
Gdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�Zedkr�ddlZe��dS)z3
This module implements a class for handling URLs.
�N)�request�URL�ImagecCs|dkrdSt�t|�d�S)N��)�cgi�escape�str)�v�r�:/opt/alt/python37/lib/python3.7/site-packages/paste/url.py�
html_quotesr
cCs|dkrdSt�t|��S)Nr)�urllib�quoter	)r
rrr�	url_quotesrcCs�|dkrdS|dkrdS|dkr$dSt|t�rBdd�tt|��St|t�rddd�d	d
�|D��St|t�rvt|�St|t�r�t|�	d��St|t
tf�r�t|�St|t�r�t|��
d�St|d
�r�|��Std|��dS)NZnullF�falseT�truez[%s]z, z{%s}cSs$g|]\}}dt|�t|�f�qS)z%s: %s)�js_repr)�.0�key�valuerrr�
<listcomp>&szjs_repr.<locals>.<listcomp>zUTF-8�L�__js_repr__z<I don't know how to turn %r into a Javascript representation)�
isinstance�list�join�mapr�dictr	�repr�unicode�encode�float�int�long�lstrip�hasattrr�
ValueError)r
rrrrs2





rc@s�eZdZdZiZd,dd�Zd-dd�Zee�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZeZdd�Zdd�Zee�Zdd�Zd d!�Zee�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZdS).�URLResourcezD
    This is an abstract superclass for different kinds of URLs
    NcCsH|pd|_|pg|_|pi|_|j��|_|p0i|_|rD|j�|�dS)N�/)�url�vars�attrs�default_params�copy�params�original_params�update)�selfr*r+r,r/rrr�__init__@s



zURLResource.__init__Tc
CsRtj|d|||d�}|r>|dkr,t�|�}qBtj|ddd�}nd}|||d�}	|	S)NF)�with_query_string�with_path_info�script_name�	path_infoT)�keep_blank_values�strict_parsing)r+)rZ
construct_urlZparse_querystringr�	parse_qsl)
�cls�environr4r5r6r7Zquerystringr*r+r
rrr�from_environKs
zURLResource.from_environcOs|�|�}|�|�}|S)N)�_add_positional�	_add_vars)r2�args�kw�resrrr�__call__as

zURLResource.__call__cCs:d|kr.|�dd�\}}|�t|�t|�i�S|�|f�S)N�=r)�splitr?�url_unquoter>)r2�item�namerrrr�__getitem__fszURLResource.__getitem__cKsbx4|��D](}|�d�r
||||dd�<||=q
W|j��}|�|�|j|j|j||jd�S)N�_���)r+r,r/)	�keys�endswithr,r.r1�	__class__r*r+r0)r2rArZ	new_attrsrrr�attrls



zURLResource.attrcKs,|j��}|�|�|j|j|j|j|d�S)N)r+r,r/)r0r.r1rNr*r+r,)r2rA�
new_paramsrrr�paramws


zURLResource.paramcCsrd}xF|��D]:\}}t|t�r$d}|�d�r||||dd�<||=qW|rntdkrdddlmat�|�}|S)NFTrJrKr)�variabledecode)�itemsrrrMrRZ
formencodeZvariable_encode)r2r+Zneed_variable_encoderrrrr�coerce_vars~s



zURLResource.coerce_varscKs0|�|�}|j|��}|j|j||j|jd�S)N)r+r,r/)rTr+rSrNr*r,r0)r2rA�new_varsrrr�var�s


zURLResource.varcKs`|�|�}g}x*|jD] \}}||kr(q|�||f�qW|�|���|j|j||j|jd�S)z�
        Like ``.var(...)``, except overwrites keys, where .var simply
        extends the keys.  Setting a variable to None here will
        effectively delete it.
        )r+r,r/)	rTr+�append�extendrSrNr*r,r0)r2rArUrH�valuesrrr�setvar�s

zURLResource.setvarcKs|j|j|��|j|jd�S)z�
        Creates a copy of this URL, but with all the variables set/reset
        (like .setvar(), except clears past variables at the same time)
        )r+r,r/)rNr*rSr,r0)r2rArrr�setvars�szURLResource.setvarscGsX|}xN|D]F}t|��d�}|j}|�d�s4|d7}|j|||j|j|jd�}q
W|S)Nr))r+r,r/)r	r%r*rMrNr+r,r0)r2�paths�u�pathZnew_urlrrr�addpath�s

zURLResource.addpathcCs||j|j|j|jd�S)N)r+r,r/)r*r+r,r0)r2Z
OtherClassrrr�become�s
zURLResource.becomecCsv|j}|jrr|d7}g}xH|jD]>\}}t|ttf�rFdd�|D�}n
|dkrPq |�||f�q W|t�|d�7}|S)N�?cSsg|]}|dk	r|�qS)Nr)rr
rrrr�sz)URLResource.href__get.<locals>.<listcomp>T)r*r+rr�tuplerWr�	urlencode)r2�sr+rH�valrrr�	href__get�szURLResource.href__getcCsnd|jj|jpdf}|jr>|dd�dd�|j��D��7}|jrf|dd�d	d�|j��D��7}|d
S)Nz<%s %sz''z
 attrs(%s)� cSs$g|]\}}dt|�t|�f�qS)z%s="%s")r
)r�nr
rrrr�sz(URLResource.__repr__.<locals>.<listcomp>z params(%s)z, cSsg|]\}}d||f�qS)z%s=%rr)rrhr
rrrr�s�>)rN�__name__�hrefr,rrSr0)r2�baserrr�__repr__�s

zURLResource.__repr__cCs�|j�d�std|��|��}d|j�d�}d�dd�|��D��}|rX|d|7}||��7}|dkrt|dSd|||j�d�fSdS)	N�tagz<You cannot get the HTML of %r until you set the 'tag' param'z<%srgcSs$g|]\}}dt|�t|�f�qS)z%s="%s")r
)rrhr
rrrr�sz)URLResource.html__get.<locals>.<listcomp>z />z
%s>%s</%s>)r/�getr'�_get_contentr�_html_attrs�_html_extra)r2�contentrnr,rrr�	html__get�szURLResource.html__getcCs
|j��S)N)r,rS)r2rrrrq�szURLResource._html_attrscCsdS)Nrr)r2rrrrr�szURLResource._html_extracCst�dS)zw
        Return the content for a tag (for self.html); return None
        for an empty tag (like ``<img />``)
        N)�NotImplementedError)r2rrrrp�szURLResource._get_contentcCst�dS)N)ru)r2r+rrrr?szURLResource._add_varscCst�dS)N)ru)r2r@rrrr>szURLResource._add_positional)NNN)TTNNN)rj�
__module__�__qualname__�__doc__r-r3r=�classmethodrCrIrOrQrTrVrZr[r_Z__div__r`rf�propertyrkrmrt�htmlrqrrrpr?r>rrrrr(8s:


	
r(c@speZdZdZddiZdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ee
�Zdd�Z
ee
�Zdd�Zee�ZdS)ra�
    >>> u = URL('http://localhost')
    >>> u
    <URL http://localhost>
    >>> u = u['view']
    >>> str(u)
    'http://localhost/view'
    >>> u['//foo'].param(content='view').html
    '<a href="http://localhost/view/foo">view</a>'
    >>> u.param(confirm='Really?', content='goto').html
    '<a href="http://localhost/view" onclick="return confirm(\'Really?\')">goto</a>'
    >>> u(title='See "it"', content='goto').html
    '<a href="http://localhost/view?title=See+%22it%22">goto</a>'
    >>> u('another', var='fuggetaboutit', content='goto').html
    '<a href="http://localhost/view/another?var=fuggetaboutit">goto</a>'
    >>> u.attr(content='goto').html
    Traceback (most recent call last):
        ....
    ValueError: You must give a content param to <URL http://localhost/view attrs(content="goto")> generate anchor tags
    >>> str(u['foo=bar%20stuff'])
    'http://localhost/view?foo=bar+stuff'
    rn�acCs|jS)N)rk)r2rrr�__str__!szURL.__str__cCs"|j�d�std|��|jdS)Nrsz8You must give a content param to %r generate anchor tags)r/ror')r2rrrrp$s
zURL._get_contentcCsV|}x*dD]"}||kr
|jf||�|�i�}q
Wd|krJ|j|�d�d�}|jf|�S)N)�confirmrs�target)r)rQ�poprOrV)r2r+r*rHrrrr?+s
z
URL._add_varscCs
|j|�S)N)r_)r2r@rrrr>4szURL._add_positionalcCsH|j��}|�dd|jf�|j�d�rD|�ddt|jd�f�|S)Nrrkr~�onclickzreturn confirm(%s))r,rS�insertrkr/rorWr)r2r,rrrrq7s
zURL._html_attrscCsdt|j�S)Nzlocation.href=%s; return false)rrk)r2rrr�onclick_goto__get?szURL.onclick_goto__getcCs
|�t�S)N)r`�Button)r2rrr�button__getDszURL.button__getcCs
|�t�S)N)r`�JSPopup)r2rrr�
js_popup__getIszURL.js_popup__getN)rjrvrwrxr-r}rpr?r>rqr�rzZonclick_gotor��buttonr�Zjs_popuprrrrrs	c@s@eZdZdZddiZdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rz�
    >>> i = Image('/images')
    >>> i = i / '/foo.png'
    >>> i.html
    '<img src="/images/foo.png" />'
    >>> str(i['alt=foo'])
    '<img src="/images/foo.png" alt="foo" />'
    >>> i.href
    '/images/foo.png'
    rnZimgcCs|jS)N)r{)r2rrrr}]sz
Image.__str__cCsdS)Nr)r2rrrrp`szImage._get_contentcCs|jf|�S)N)rO)r2r+rrrr?cszImage._add_varscCs
|j|�S)N)r_)r2r@rrrr>fszImage._add_positionalcCs |j��}|�dd|jf�|S)Nr�src)r,rSr�rk)r2r,rrrrqis
zImage._html_attrsN)
rjrvrwrxr-r}rpr?r>rqrrrrrNsc@s@eZdZdZddiZdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)r�z�
    >>> u = URL('/')
    >>> u = u / 'delete'
    >>> b = u.button['confirm=Sure?'](id=5, content='del')
    >>> str(b)
    '<button onclick="if (confirm(\'Sure?\')) {location.href=\'/delete?id=5\'}; return false">del</button>'
    rnr�cCs|jS)N)r{)r2rrrr}zszButton.__str__cCs0|j�d�r|jdS|j�d�r,|jdSdS)Nrsr)r/ror,)r2rrrrp}s


zButton._get_contentcCsD|}d|kr|j|�d�d�}d|kr8|j|�d�d�}|jf|�S)Nr~)r~rs)rs)rQr�rV)r2r+r�rrrr?�szButton._add_varscCs
|j|�S)N)r_)r2r@rrrr>�szButton._add_positionalcCsV|j��}dt|j�}|j�d�r:dt|jd�|f}|d7}|�dd|f�|S)Nzlocation.href=%sr~zif (confirm(%s)) {%s}z; return falserr�)r,rSrrkr/ror�)r2r,r�rrrrq�s
zButton._html_attrsN)
rjrvrwrxr-r}rpr?r>rqrrrrr�nsr�c@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)r�z�
    >>> u = URL('/')
    >>> u = u / 'view'
    >>> j = u.js_popup(content='view')
    >>> j.html
    '<a href="/view" onclick="window.open(\'/view\', \'_blank\'); return false" target="_blank">view</a>'
    r|Z_blank)rnrcCs<|}x*dD]"}||kr
|jf||�|�i�}q
W|jf|�S)N)�width�height�strippedrs)rQr�rV)r2r+r�rVrrrr?�s

zJSPopup._add_varscCs�|j}g}|�d�r,d|d<|d<|d<xJd��D]>}||krDq6||}|dkrb|r^d}nd}|�d	||f�q6Wx.d
D]&}|�|�s�q~|�d	|||f�q~W|j|dg}|r�|�d�|��d
�tt|��S)Nr��0�location�statusZtoolbarzXchannelmode directories fullscreen location menubar resizable scrollbars status titlebar)�yes�no�1r�r�z%s=%szheight left top widthr�,z, )r/rorErWrkrrr)r2�p�featuresrQr
r@rrr�_window_args�s*


zJSPopup._window_argscCsR|j��}d|��}|�dd|jdf�|�dd|f�|�dd|jf�|S)Nzwindow.open(%s); return falserrr�rk)r,rSr�r�r/rk)r2r,r�rrrrq�s

zJSPopup._html_attrscCs"|j�d�std|��|jdS)Nrsz8You must give a content param to %r generate anchor tags)r/ror')r2rrrrp�s
zJSPopup._get_contentcCs
|j|�S)N)r_)r2r@rrrr>�szJSPopup._add_positionalN)
rjrvrwrxr-r?r�rqrpr>rrrrr��s
	r��__main__)rxrr�pasterrR�__all__r
r�unquoterFr�objectr(rrr�r�rjZdoctestZtestmodrrrr�<module>s$OH ,>

Youez - 2016 - github.com/yon3zu
LinuXploit