B
    `g                 @   s:   d dl Z d dlmZmZ G dd dZde jfddZdS )    N)asboolaslistc               @   s&   e Zd Zdd ZdddZdd ZdS )	SettingsConfiguratorMixinc             C   s    |d kri }t |}|| j_|S )N)Settingsregistrysettings)selfmappingr    r
   _/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pyramid/config/settings.py_set_settings   s
    z'SettingsConfiguratorMixin._set_settingsNc             K   s>   |dkri }| j j}|dkr&| |}|| || dS )a(  Augment the :term:`deployment settings` with one or more
        key/value pairs.

        You may pass a dictionary::

           config.add_settings({'external_uri':'http://example.com'})

        Or a set of key/value pairs::

           config.add_settings(external_uri='http://example.com')

        This function is useful when you need to test code that accesses the
        :attr:`pyramid.registry.Registry.settings` API (or the
        :meth:`pyramid.config.Configurator.get_settings` API) and
        which uses values from that API.
        N)r   r   r   update)r   r   kwZutilityr
   r
   r   add_settings   s    

z&SettingsConfiguratorMixin.add_settingsc             C   s   | j jS )a  
        Return a :term:`deployment settings` object for the current
        application.  A deployment settings object is a dictionary-like
        object that contains key/value pairs based on the dictionary passed
        as the ``settings`` argument to the
        :class:`pyramid.config.Configurator` constructor.

        .. note:: the :attr:`pyramid.registry.Registry.settings` API
           performs the same duty.
        )r   r   )r   r
   r
   r   get_settings'   s    z&SettingsConfiguratorMixin.get_settings)N)__name__
__module____qualname__r   r   r   r
   r
   r
   r   r      s   
r   c                sp   dkri  t    jf | |jdd dtdf fdd	} fdd}|d	d
t |ddt |dd	 |ddt |dd	 |ddt |dd	 |ddt |dd	 |ddt |ddt |dd |ddt |dd |ddt |dd x0dd D ]} d p, d  |< qW |ddtd |ddt |d d!t |d"d#tg   S )$zDeployment settings.  Update application settings (usually
    from PasteDeploy keywords) with framework-specific key/value pairs
    (e.g. find ``PYRAMID_DEBUG_AUTHORIZATION`` in os.environ and jam into
    keyword args).Nc             S   s"   | g}|  ds|d|   |S )Nzpyramid.)
startswithappend)keykeysr
   r
   r   
expand_keyA   s    
zSettings.<locals>.expand_keyFc                sX   | | }x|D ]} |  qW |r4|  |   fdd|D  d S )Nc                s   i | ]
} |qS r
   r
   ).0k)valuer
   r   
<dictcomp>O   s    z'Settings.<locals>.S.<locals>.<dictcomp>)getr   )settings_keyZenv_keytype_defaultr   r   )degetr   )r   r   SG   s    

zSettings.<locals>.Sc                s*   x$| D ]} | p |  |< q
W d S )Nr
   )r   Zoverride_keyr   )r!   r   r
   r   OQ   s    zSettings.<locals>.OZ	debug_allZPYRAMID_DEBUG_ALLZdebug_authorizationZPYRAMID_DEBUG_AUTHORIZATIONZdebug_notfoundZPYRAMID_DEBUG_NOTFOUNDZdebug_routematchZPYRAMID_DEBUG_ROUTEMATCHZdebug_templatesZPYRAMID_DEBUG_TEMPLATESZ
reload_allZPYRAMID_RELOAD_ALLZreload_templatesZPYRAMID_RELOAD_TEMPLATESZreload_assetsZPYRAMID_RELOAD_ASSETSZreload_resourcesZPYRAMID_RELOAD_RESOURCESZdefault_locale_nameZPYRAMID_DEFAULT_LOCALE_NAMEenZprevent_http_cacheZPYRAMID_PREVENT_HTTP_CACHEZprevent_cachebustZPYRAMID_PREVENT_CACHEBUSTZcsrf_trusted_originsZPYRAMID_CSRF_TRUSTED_ORIGINS)dictr   r   strr   r   )r!   Z	_environ_r   r#   r$   r   r
   )r!   r"   r   r   r   5   s>    







r   )osZpyramid.settingsr   r   r   environr   r
   r
   r
   r   <module>   s   /