ó
mÜJ]c           @` sƒ   d  Z  d d l m Z m Z m Z m Z d d l Z e j e ƒ Z	 d d l
 m Z d d l m Z d	 Z d e f d „  ƒ  YZ d S(
   uˆ    Provide a Request handler that lists the application (if more than one)
or (if only one) redirects to the route of that applications.

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   gen(   t   RequestHandleru   RootHandlert   RootHandlerc           B` s)   e  Z d  Z d „  Z e j d „  ƒ Z RS(   u’    Implements a custom Tornado handler to display the available applications
    If only one application it redirects to that application route
    c         O` s8   | d |  _  | d |  _ | d |  _ | d |  _ d  S(   Nu   applicationsu   prefixu   indexu   use_redirect(   t   applicationst   prefixt   indext   use_redirect(   t   selft   argst   kw(    (    s>   lib/python2.7/site-packages/bokeh/server/views/root_handler.pyt
   initialize5   s    c         O` s¹   |  j  d  k r d n |  j  } |  j ro t |  j ƒ d k ro t |  j j ƒ  ƒ } | | d } |  j | ƒ nF |  j d  k r„ d n |  j } |  j	 | d | d t
 |  j j ƒ  ƒ ƒd  S(   Nu    i   i    u   app_index.htmlR   t   items(   R   t   NoneR
   t   lenR   t   listt   keyst   redirectR	   t   rendert   sorted(   R   R   t   kwargsR   t	   app_namest   redirect_toR	   (    (    s>   lib/python2.7/site-packages/bokeh/server/views/root_handler.pyt   get;   s    (   t   __name__t
   __module__t   __doc__R   R   t	   coroutineR   (    (    (    s>   lib/python2.7/site-packages/bokeh/server/views/root_handler.pyR   0   s   	(   u   RootHandler(   R   t
   __future__R    R   R   R   t   loggingt	   getLoggerR   t   logt   tornadoR   t   tornado.webR   t   __all__R   (    (    (    s>   lib/python2.7/site-packages/bokeh/server/views/root_handler.pyt   <module>
   s   "		