%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyc

�
a�Nc@s�dZddlZddlZddlmZdaddgZd�Zd�Z	ej
Zd�Zd	e
fd
��YZdefd��YZdefd��YZd
efd��YZdefd��YZedkr�ddlZej�ndS(s3
This module implements a class for handling URLs.
i����N(trequesttURLtImagecCs&|dkrdStjt|�d�S(Nti(tNonetcgitescapetstr(tv((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt
html_quotescCs#|dkrdStjt|��S(NR(RturllibtquoteR(R((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt	url_quotescCsQ|dkrdS|tkr dS|tkr0dSt|t�rYddjtt|��St|t�r�ddjg|D](\}}dt|�t|�f^qx�St|t	�r�t
|�St|t�r�t
|jd��St|t
tf�rt
|�St|t�r$t
|�jd	�St|d
�r=|j�Std|��dS(Ntnulltfalsettrues[%s]s, s{%s}s%s: %ssUTF-8tLt__js_repr__s<I don't know how to turn %r into a Javascript representation(RtFalsetTruet
isinstancetlisttjointmaptjs_reprtdictRtreprtunicodetencodetfloattinttlongtlstripthasattrRt
ValueError(Rtkeytvalue((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRs2	4


tURLResourcecBs
eZdZiZdddd�Zeedddd�Zee�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�ZeZd�Zd
�Zee�Zd�Zd�Zee�Zd�Zd�Zd�Zd�Zd�ZRS(sD
    This is an abstract superclass for different kinds of URLs
    cCsk|p	d|_|pg|_|p'i|_|jj�|_|pHi|_|rg|jj|�ndS(Nt/(turltvarstattrstdefault_paramstcopytparamstoriginal_paramstupdate(tselfR'R(R)R,((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt__init__@sc

Cs�tj|dtd|d|d|�}|ri|dkrKtj|�}qotj|dtdt�}nd}||d|�}	|	S(Ntwith_query_stringtwith_path_infotscript_namet	path_infotkeep_blank_valueststrict_parsingR((Rt
construct_urlRRtparse_querystringRt	parse_qslR(
tclstenvironR1R2R3R4tquerystringR'R(R((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytfrom_environKs	cOs"|j|�}|j|�}|S(N(t_add_positionalt	_add_vars(R/targstkwtres((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt__call__ascCsTd|krD|jdd�\}}|jit|�t|�6�S|j|f�S(Nt=i(tsplitR?turl_unquoteR>(R/titemtnameR$((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt__getitem__fs cKs�x?|j�D]1}|jd�r
||||d <||=q
q
W|jj�}|j|�|j|jd|jd|d|j�S(Nt_i����R(R)R,(	tkeystendswithR)R+R.t	__class__R'R(R-(R/RAR#t	new_attrs((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytattrls
cKsD|jj�}|j|�|j|jd|jd|jd|�S(NR(R)R,(R-R+R.RMR'R(R)(R/RAt
new_params((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytparamws

	cCs�t}x]|j�D]O\}}t|t�r7t}n|jd�r||||d <||=qqW|r�tdkr�ddlmantj	|�}n|S(NRJi����(tvariabledecode(
RtitemsRRRRLRRRt
formencodetvariable_encode(R/R(tneed_variable_encodeR#R$((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytcoerce_vars~s	cKsJ|j|�}|j|j�}|j|jd|d|jd|j�S(NR(R)R,(RWR(RSRMR'R)R-(R/RAtnew_vars((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytvar�s
	cKs�|j|�}g}x<|jD]1\}}||kr=qn|j||f�qW|j|j��|j|jd|d|jd|j�S(s�
        Like ``.var(...)``, except overwrites keys, where .var simply
        extends the keys.  Setting a variable to None here will
        effectively delete it.
        R(R)R,(	RWR(tappendtextendRSRMR'R)R-(R/RARXRHtvalues((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytsetvar�s	cKs.|j|jd|j�d|jd|j�S(s�
        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,(RMR'RSR)R-(R/RA((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytsetvars�s	c	Gs�|}xv|D]n}t|�jd�}|j}|jd�sM|d7}n|j||d|jd|jd|j�}q
W|S(NR&R(R)R,(RR R'RLRMR(R)R-(R/tpathstutpathtnew_url((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytaddpath�s
	
	cCs(||jd|jd|jd|j�S(NR(R)R,(R'R(R)R-(R/t
OtherClass((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytbecome�s	cCs�|j}|jr�|d7}g}xy|jD]n\}}t|ttf�rug|D]}|dk	rT|^qT}n|dkr�q,n|j||f�q,W|tj|t	�7}n|S(Nt?(
R'R(RRttupleRRZR
t	urlencodeR(R/tsR(RHtvalR((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt	href__get�s		
(c
Cs�d|jj|jpdf}|jrz|ddjg|jj�D](\}}dt|�t|�f^qD�7}n|jr�|ddjg|jj�D]\}}d||f^q��7}n|d	S(
Ns<%s %ss''s
 attrs(%s)t s%s="%s"s params(%s)s, s%s=%rt>(RMt__name__threfR)RRSR	R-(R/tbasetnR((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt__repr__�s		C		7cCs�|jjd�s%td|��n|j�}d|jjd�}djg|j�D](\}}dt|�t|�f^qZ�}|r�|d|7}n||j�7}|dkr�|dSd|||jjd�fSdS(Nttags<You cannot get the HTML of %r until you set the 'tag' param's<%sRls%s="%s"s />s
%s>%s</%s>(	R,tgetR"t_get_contentRt_html_attrsR	t_html_extraR(R/tcontentRsRqRR)((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt	html__get�s
;cCs
|jj�S(N(R)RS(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRv�scCsdS(NR((R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRw�scCs
t�dS(sw
        Return the content for a tag (for self.html); return None
        for an empty tag (like ``<img />``)
        N(tNotImplementedError(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRu�scCs
t�dS(N(Rz(R/R(((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR?scCs
t�dS(N(Rz(R/R@((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR>sN(Rnt
__module__t__doc__R*RR0RR=tclassmethodRCRIRORQRWRYR]R^Rct__div__ReRktpropertyRoRrRythtmlRvRwRuR?R>(((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR%8s:
													
					cBs�eZdZidd6Zd�Zd�Zd�Zd�Zd�Zd�Z	e
e	�Zd	�Ze
e�Z
d
�Ze
e�ZRS(s�
    >>> 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'
    taRscCs|jS(N(Ro(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt__str__!scCs0|jjd�s%td|��n|jdS(NRxs8You must give a content param to %r generate anchor tags(R,RtR"(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRu$s

cCs||}x<dD]4}||kr
|ji|j|�|6�}q
q
Wd|kro|jd|jd��}n|j|�S(NtconfirmRxttarget(sconfirmscontent(RQtpopRORY(R/R(R'RH((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR?+s
&cCs
|j|�S(N(Rc(R/R@((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR>4scCse|jj�}|jdd|jf�|jjd�ra|jddt|jd�f�n|S(NiRoR�tonclicksreturn confirm(%s)(R)RStinsertRoR,RtRZR(R/R)((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRv7scCsdt|j�S(Nslocation.href=%s; return false(RRo(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytonclick_goto__get?scCs
|jt�S(N(RetButton(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pytbutton__getDscCs
|jt�S(N(RetJSPopup(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt
js_popup__getIs(RnR{R|R*R�RuR?R>RvR�Rtonclick_gotoR�tbuttonR�tjs_popup(((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRs
									cBsHeZdZidd6Zd�Zd�Zd�Zd�Zd�ZRS(s�
    >>> 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'
    timgRscCs|jS(N(R�(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR�]scCsdS(N(R(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRu`scCs
|j|�S(N(RO(R/R(((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR?cscCs
|j|�S(N(Rc(R/R@((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR>fscCs,|jj�}|jdd|jf�|S(Nitsrc(R)RSR�Ro(R/R)((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRvis(	RnR{R|R*R�RuR?R>Rv(((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRNs
				R�cBsHeZdZidd6Zd�Zd�Zd�Zd�Zd�ZRS(s�
    >>> 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>'
    R�RscCs|jS(N(R�(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR�zscCs>|jjd�r|jdS|jjd�r:|jdSdS(NRxR$(R,RtR)R(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRu}s
cCsg|}d|kr0|jd|jd��}nd|krZ|jd|jd��}n|j|�S(NR�Rx(RQR�RY(R/R(R�((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR?�scCs
|j|�S(N(Rc(R/R@((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR>�scCsx|jj�}dt|j�}|jjd�rTdt|jd�|f}n|d7}|jdd|f�|S(Nslocation.href=%sR�sif (confirm(%s)) {%s}s; return falseiR�(R)RSRRoR,RtR�(R/R)R�((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRv�s
(	RnR{R|R*R�RuR?R>Rv(((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR�ns
				R�cBsOeZdZidd6dd6Zd�Zd�Zd�Zd�Zd	�ZRS(
s�
    >>> 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�Rst_blankR�cCsR|}x<dD]4}||kr
|ji|j|�|6�}q
q
W|j|�S(NtwidththeighttstrippedRx(swidthR�R�scontent(RQR�RY(R/R(R�RY((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR?�s

&cCs2|j}g}|jd�r;d|d<|d<|d<nxkdj�D]]}||kr`qHn||}|dkr�|r�d	}q�d}n|jd
||f�qHWx>dD]6}|j|�s�q�n|jd
|||f�q�W|j|dg}|r|jd
j|��ndjtt|��S(NR�t0tlocationtstatusttoolbarsXchannelmode directories fullscreen location menubar resizable scrollbars status titlebartyestnot1s%s=%ssheight left top widthR�t,s, (syesR�R�R�(R,RtRERZRoRRR(R/tptfeaturesRQRR@((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt_window_args�s*	
		
cCso|jj�}d|j�}|jdd|jdf�|jdd|f�|jdd|jf�|S(Nswindow.open(%s); return falseiR�R�Ro(R)RSR�R�R,Ro(R/R)R�((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRv�s
cCs0|jjd�s%td|��n|jdS(NRxs8You must give a content param to %r generate anchor tags(R,RtR"(R/((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyRu�s

cCs
|j|�S(N(Rc(R/R@((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR>�s(	RnR{R|R*R?R�RvRuR>(((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyR��s					t__main__(R|R
RtpasteRRRRt__all__R	RtunquoteRFRtobjectR%RRR�R�Rntdoctestttestmod(((s:/opt/alt/python27/lib/python2.7/site-packages/paste/url.pyt<module>s"				�H ,>

Zerion Mini Shell 1.0