ó
şĘRc           @   s0  d  Z  d d l Z d d l Z d d l Z d d l m Z d d l Z d d l Z d d l	 m
 Z
 d d l m Z d d l m Z d d l m Z d d l m Z d d	 l m Z d d
 l m Z d d l m Z m Z d d l m Z d d l m Z d d l m Z d g Z  e j! e  Z" e# d  Z$ d S(   s:   WSGI middleware initialization for the Monkey application.i˙˙˙˙N(   t   Retry(   t   EmailErrors(   t   CatchMakoErrors(   t   PrintRawErrors(   t   CgitbMiddleware(   t   UnrewriteMiddleware(   t   SaveEnviron(   t   OptionalProfileMiddleware(   t   wrap_appt   render_html_error(   t   util(   t   base_config(   t   load_environmentt   make_appc         K   s  t  j t _ t  j   t |  d t d d   | } t | d d d t j t	 j
 j f } t | d t j d  d	 d
 t d t d d } t | i d d 6d d 6 } t | d |  d d |  d d |  d d |  d } t |  } d d l m } t | |  } t | d t } | S(   s`  
    Set Monkey up with the settings found in the PasteDeploy configuration
    file used.
    
    :param global_conf: The global settings for Monkey (those
        defined under the ``[DEFAULT]`` section).
    :type global_conf: dict
    :param full_stack: Should the whole TG2 stack be set up?
    :type full_stack: str or bool
    :return: The Monkey application with all the relevant middleware
        loaded.
    
    This is the PasteDeploy factory for the Monkey application.
    
    ``app_conf`` contains all the application-specific settings (those defined
    under ``[app:main]``.
    
   
    t
   full_stackR   c         S   s   t  |  t  S(   N(   R   R   (   t   a(    (    s>   /mit/sca/Scripts/turbogears/Monkey/monkey/config/middleware.pyt   <lambda>>   s    t   triesi   t	   retryablet   log_filenames   .bazki.profilei   t   discard_first_requestt   flush_at_shutdownt   paths   /profilet    s   dispatch.fcgit   devs   dispatch.cgit	   from_addrt   error_email_fromt   to_addrt   email_tot   subject_prefixt   error_subject_prefixt   smtp_serveri˙˙˙˙(   t   TeXFailedErrort   gen_html(   R
   t   showwarningt   warningst   filterwarningst   make_base_appt   FalseR    t   MySQLdbt   OperationalErrort
   sqlalchemyt   excR   t   tempfilet   mkstempt   TrueR   R   R   t   bazki.latexR    R   R   R	   (   t   global_confR   t   app_conft   appR    (    (    s>   /mit/sca/Scripts/turbogears/Monkey/monkey/config/middleware.pyR   !   s0    
		

(%   t   __doc__R+   R#   t   tgt   repoze.retryR    R'   t   sqlalchemy.excR)   t   bazjunk.middleware.emailR   t   bazjunk.middleware.makoR   t   bazjunk.middleware.rawR   t   bazjunk.middleware.cgitbR   t   bazjunk.middleware.rewriteR   t   bazjunk.middleware.environR   t   bazjunk.middleware.profilerR   t   bazki.turbogearsR   R	   t   bazkiR
   t   monkey.config.app_cfgR   t   monkey.config.environmentR   t   __all__t   setup_tg_wsgi_appR%   R-   R   (    (    (    s>   /mit/sca/Scripts/turbogears/Monkey/monkey/config/middleware.pyt   <module>   s(   	