File: //opt/alt/python27/lib/python2.7/site-packages/paste/cascade.pyo
�
a�Nc           @   sz   d  Z  d d l m Z d d l m Z d d l Z d d l m Z d g Z d d � Z	 d e
 f d	 �  �  YZ d
 �  Z d S(   sZ   
Cascades through several applications, so long as applications
return ``404 Not Found``.
i����(   t   httpexceptions(   t
   convertersN(   t   StringIOt   Cascadet   404c         K   s�   t  t t j | � � } g  } xj | j �  D]\ \ } } | j d � s_ t d | | f � � n  |  j | d | �} | j | | f � q+ W| j	 �  g  | D] \ } } | ^ q� } t
 | d | �S(   s!  
    Entry point for Paste Deploy configuration
    
    Expects configuration like::
        [composit:cascade]
        use = egg:Paste#cascade
        # all start with 'app' and are sorted alphabetically
        app1 = foo
        app2 = bar
        ...
        catch = 404 500 ...
    t   appsL   Bad configuration key %r (=%r); all configuration keys must start with 'app't   global_conft   catch(   t   mapt   intR   t   aslistt   itemst
   startswitht
   ValueErrort   get_appt   appendt   sortR   (   t   loaderR   R   t
   local_conft   appst   namet   valueR   (    (    s>