%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/paste/
Upload File :
Create Path :
Current File : //proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyo

�
b�Nc@s�dZddlmZddlZddlZddlZddlmZddgZd�Z	d�Z
defd	��YZdefd
��YZ
dS(s8
Map URL prefixes to WSGI applications.  See ``URLMap``
i����(t	DictMixinN(thttpexceptionstURLMaptPathProxyURLMapcKs�d|kr|jd�}n|jd�}|rK|j|d|�}ntd|�}xE|j�D]7\}}t|�}|j|d|�}|||<qgW|S(Nt
not_found_apptglobal_conf(tpoptgettget_appRtitemstparse_path_expression(tloaderRt
local_confRturlmaptpathtapp_nametapp((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyturlmap_factoryscCsz|j�}d}}}x�|r
|ddkr||jd�|sUtd��n|rjtd��n|jd�}q|ddkr�|jd�|s�td��n|r�td��n|jd�}q|r�td||df��n|jd�}qWd	}|r$d
|}n|rP|s?td��n|d|7}n|rv|ri|d
7}n||7}n|S(s�
    Parses a path expression like 'domain foobar.com port 20 /' or
    just '/foobar' for a path alone.  Returns as an address that
    URLMap likes.
    itdomains,'domain' must be followed with a domain names'domain' given twicetports*'port' must be followed with a port numbers'port' given twices*more than one path given (have %r, got %r)ts	http://%ss/If you give a port, you must also give a domaint:t/N(tsplittNoneRt
ValueError(RtpartsRRts((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyR
sB	




cBs�eZdZdd�Zejd�Zejd�Zd�Z	e
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�ZRS(
s�
    URLMap instances are dictionary-like object that dispatch to one
    of several applications based on the URL.

    The dictionary keys are URLs to match (like
    ``PATH_INFO.startswith(url)``), and the values are applications to
    dispatch to.  URLs are matched most-specific-first, i.e., longest
    URL first.  The ``SCRIPT_NAME`` and ``PATH_INFO`` environmental
    variables are adjusted to indicate the new context.

    URLs can also include domains, like ``http://blah.com/foo``, or as
    tuples ``('blah.com', '/foo')``.  This will match domain names; without
    the ``http://domain`` or with a domain of ``None`` any domain will be
    matched (so long as no other explicit domain matches).  cCs(g|_|s|j}n||_dS(N(tapplicationsRtnot_found_application(tselfR((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt__init__Ws	s//+s^(http|https)://c	Cs�|jd�}|rVg|jD]\}}|^q}ddjtt|��}nd}|d|jd�7}|d|jd�7}|d	|jd
�7}tj|ddtj|��j	}|||�S(Nspaste.urlmap_objectsdefined apps: %ss,
  Rs
SCRIPT_NAME: %rtSCRIPT_NAMEs
PATH_INFO: %rt	PATH_INFOs
HTTP_HOST: %rt	HTTP_HOSTtcomment(
RRtjointmaptreprRtHTTPNotFoundtcgitescapetwsgi_application(	Rtenvirontstart_responsetmappertptatmatchestextraR((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyR`s"
cCs�t|ttf�r@|d}|j|d�d}||fS|jj|�}|r�||j�}d|kr�|jdd�\}}d|}q�|d}}nd}|j	j
d|�}|r�|jd�}n||fS(NiiRR(t
isinstancetlistttuplet
normalize_urlt
domain_url_retsearchtendRRtnorm_url_retsubtrstrip(RturlttrimRtmatch((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyR5ps 


cCsad�}g|jD]}||�|f^q}|j�g|D]\}}|^qB|_dS(sK
        Make sure applications are sorted with longest URLs first
        cSs>|\\}}}|s)dt|�fS|t|�fSdS(Ns�(tlen(tapp_descRR<R((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pytkey�sN(Rtsort(RRAtdesctappstsortable((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt	sort_apps�s	(
cCsx|dkr/y||=Wntk
r*nXdS|j|�}||krT||=n|jj||f�|j�dS(N(RtKeyErrorR5RtappendRF(RR<Rtdom_url((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt__setitem__�s

cCsg|j|�}x'|jD]\}}||kr|SqWtd|d|dpSd|jf��dS(Ns9No application with the url %r (domain: %r; existing: %s)iit*(R5RRG(RR<RItapp_urlR((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt__getitem__�scCsf|j|�}xP|jD]2\}}||kr|jj||f�PqqWtd|f��dS(NsNo application with the url %r(R5RtremoveRG(RR<RLR((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt__delitem__�scCs g|jD]\}}|^q
S(N(R(RRLR((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pytkeys�sc	CsB|jd|jd��j�}d|krH|jdd�\}}n|ddkrad}nd}|jd	�}|j|t�d}x�|jD]�\\}}}|r�||kr�||d|kr�q�n||ks�|j|d
�r�|dc|7<|t|�|d	<|||�Sq�W||d<|j||�S(
NR"tSERVER_NAMERiswsgi.url_schemethttpt80t443R!RR spaste.urlmap_object(	RtlowerRR5tFalseRt
startswithR?R(	RR+R,thostRt	path_infoRRLR((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt__call__�s$!	&
N(t__name__t
__module__t__doc__RRtretcompileR9R6RtTrueR5RFRJRMRORPRZ(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyRFs			
			
	cBsJeZdZd�Zd�Zd�Zd�Zd�Zeee�Z	RS(s�
    This is a wrapper for URLMap that catches any strings that
    are passed in as applications; these strings are treated as
    filenames (relative to `base_path`) and are passed to the
    callable `builder`, which will return an application.

    This is intended for cases when configuration files can be
    treated as applications.

    `base_paste_url` is the URL under which all applications added through
    this wrapper must go.  Use ``""`` if you want this to not
    change incoming URLs.
    cCs4||_|jj|�|_||_||_dS(N(R%R5tbase_paste_urlt	base_pathtbuilder(RR%RaRbRc((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyR�s		cCs�t|ttf�r?tjj|j|�}|j|�}n|jj	|�}|dpe|j
d|j
d|df}||j|<dS(Nii(R2tstrtunicodetosRR$RbRcR%R5Ra(RR<Rtapp_fn((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyRJ�scCst|j|�S(N(tgetattrR%(Rtattr((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt__getattr__�scCs
|jjS(N(R%R(R((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pytnot_found_application__get�scCs||j_dS(N(R%R(Rtvalue((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pytnot_found_application__set�s(
R[R\R]RRJRjRkRmtpropertyR(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyR�s					(R]tUserDictRR^RfR(tpasteRt__all__RR
RtobjectR(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt<module>s		)�

Zerion Mini Shell 1.0