File: //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyo
�
b�Nc @ s� d Z d d l m Z d d l Z d d l Z d d l Z d d l m Z d d g Z d � Z d � Z
d e f d � � YZ d e f d
� � YZ
d S( s8
Map URL prefixes to WSGI applications. See ``URLMap``
i����( t DictMixinN( t httpexceptionst URLMapt PathProxyURLMapc K s� d | k r | j d � } n | j d � } | rK | j | d | �} n t d | � } xE | j � D]7 \ } } t | � } | j | d | �} | | | <qg W| S( Nt
not_found_appt global_conf( t popt gett get_appR t itemst parse_path_expression( t loaderR t
local_confR t urlmapt patht app_namet app( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt urlmap_factory s c C sz | j � } d } } } x� | r
| d d k r| | j d � | sU t d � � n | rj t d � � n | j d � } q | d d k r� | j d � | s� t d � � n | r� t d � � n | j d � } q | r� t d | | d f � � n | j d � } q Wd } | r$d
| } n | rP| s?t d � � 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.
i t domains, 'domain' must be followed with a domain names 'domain' given twicet ports* 'port' must be followed with a port numbers 'port' given twices* more than one path given (have %r, got %r)t s http://%ss/ If you give a port, you must also give a domaint :t /N( t splitt NoneR t
ValueError( R t partsR R t s( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyR
sB
c B s� e Z d Z d d � Z e j d � Z e j d � Z d � Z e
d � Z d � Z d � Z
d � Z d � Z d
� Z d � Z RS(
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). c C s( g | _ | s | j } n | | _ d S( N( t applicationsR t not_found_application( t selfR ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyt __init__W s s //+s ^(http|https)://c C s� | j d � } | rV g | j D] \ } } | ^ q } d d j t t | � � } n d } | d | j d � 7} | d | j d � 7} | d | j d
� 7} t j | d d t j | � �j } | | | � S( Ns paste.urlmap_objects defined apps: %ss ,
R s
SCRIPT_NAME: %rt SCRIPT_NAMEs
PATH_INFO: %rt PATH_INFOs
HTTP_HOST: %rt HTTP_HOSTt comment(
R R t joint mapt reprR t HTTPNotFoundt cgit escapet wsgi_application( R t environt start_responset mappert pt at matchest extraR ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyR ` s "
c C s� t | t t f � r@ | d } | j | d � d } | | f S| j j | � } | r� | | j � } d | k r� | j d d � \ } } d | } q� | d } } n d } | j j
d | � } | r� | j d � } n | | f S( Ni i R R ( t
isinstancet listt tuplet
normalize_urlt
domain_url_ret searcht endR R t norm_url_ret subt rstrip( R t urlt trimR t match( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/urlmap.pyR5 p s
c C sa d � } g | j D] } | | � | f ^ q } | j � g | D] \ } } | ^ qB | _ d S( sK
Make sure applications are sorted with longest URLs first
c S s>