ó
³Ebc           @   s    d  Z  d e f d „  ƒ  YZ d S(   sY  
Application Dispatcher
======================

This middleware creates a single WSGI application that dispatches to
multiple other WSGI applications mounted at different URL paths.

A common example is writing a Single Page Application, where you have a
backend API and a frontend written in JavaScript that does the routing
in the browser rather than requesting different pages from the server.
The frontend is a single HTML and JS file that should be served for any
path besides "/api".

This example dispatches to an API app under "/api", an admin app
under "/admin", and an app that serves frontend files for all other
requests::

    app = DispatcherMiddleware(serve_frontend, {
        '/api': api_app,
        '/admin': admin_app,
    })

In production, you might instead handle this at the HTTP server level,
serving files or proxying to application servers based on location. The
API and admin apps would each be deployed with a separate WSGI server,
and the static files would be served directly by the HTTP server.

.. autoclass:: DispatcherMiddleware

:copyright: 2007 Pallets
:license: BSD-3-Clause
t   DispatcherMiddlewarec           B   s#   e  Z d  Z d d „ Z d „  Z RS(   sJ  Combine multiple applications as a single WSGI application.
    Requests are dispatched to an application based on the path it is
    mounted under.

    :param app: The WSGI application to dispatch to if the request
        doesn't match a mounted path.
    :param mounts: Maps path prefixes to applications for dispatching.
    c         C   s   | |  _  | p i  |  _ d  S(   N(   t   appt   mounts(   t   selfR   R   (    (    sv   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/middleware/dispatcher.pyt   __init__-   s    	c         C   sÂ   | j  d d ƒ } d } xp d | k rr | |  j k rG |  j | } Pn  | j d d ƒ \ } } d | | f } q W|  j j  | |  j ƒ } | j  d d ƒ } | | | d <| | d <| | | ƒ S(   Nt	   PATH_INFOt    t   /i   s   /%s%st   SCRIPT_NAME(   t   getR   t   rsplitR   (   R   t   environt   start_responset   scriptt	   path_infoR   t	   last_itemt   original_script_name(    (    sv   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/middleware/dispatcher.pyt   __call__1   s    
N(   t   __name__t
   __module__t   __doc__t   NoneR   R   (    (    (    sv   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/middleware/dispatcher.pyR    #   s   N(   R   t   objectR    (    (    (    sv   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/middleware/dispatcher.pyt   <module>    s   