• File: middleware.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/beaker/__pycache__/middleware.cpython-37.pyc
  • Date Modified: 12/01/2019 7:12 PM
  • File size: 5.52 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

iA\R@sddlZy$ddlmZeddZeddZWndZdZYnXddlmZddlmZm	Z	ddl
mZmZm
Z
Gd	d
d
eZGdddeZd
dZddZdS)N)StackedObjectProxyzBeaker Session)namez
Cache Manager)CacheManager)Session
SessionObject)coerce_cache_paramscoerce_session_paramsparse_cache_config_optionsc@s"eZdZeZdddZddZdS)CacheMiddlewareNbeaker.cachecKsl||_|pi}i|_|jt||jt|dd|jsH|rH||_|j|tf|j|_||_dS)aInitialize the Cache Middleware

        The Cache middleware will make a CacheManager instance available
        every request under the ``environ['beaker.cache']`` key by
        default. The location in environ can be changed by setting
        ``environ_key``.

        ``config``
            dict  All settings should be prefixed by 'cache.'. This
            method of passing variables is intended for Paste and other
            setups that accumulate multiple component settings in a
            single dictionary. If config contains *no cache. prefixed
            args*, then *all* of the config options will be used to
            intialize the Cache objects.

        ``environ_key``
            Location where the Cache instance will keyed in the WSGI
            environ

        ``**kwargs``
            All keyword arguments are assumed to be cache settings and
            will override any settings found in ``config``

        F)Zinclude_defaultsN)appoptionsupdater	r
cache_managerenviron_key)selfrconfigrkwargsrB/opt/alt/python37/lib/python3.7/site-packages/beaker/middleware.py__init__s
zCacheMiddleware.__init__cCs@|dr(|djr(|d|j|j|j||j<|||S)Nzpaste.registry)getreglistregistercacherrr)renvironstart_responserrr__call__Cs

zCacheMiddleware.__call__)Nr)__name__
__module____qualname__beaker_cacherrrrrrrr
s
/r
c@s*eZdZeZd	ddZddZddZdS)
SessionMiddlewareNbeaker.sessionc
Ks|pi}tddddddddd|_x||gD]|}xv|D]j\}}|dr^||j|dd<|drz||j|dd<|d	r:td
td||j|dd<q:Wq,Wt|j|js|r||_|j|||_	|_
||_dS)aInitialize the Session Middleware

        The Session middleware will make a lazy session instance
        available every request under the ``environ['beaker.session']``
        key by default. The location in environ can be changed by
        setting ``environ_key``.

        ``config``
            dict  All settings should be prefixed by 'session.'. This
            method of passing variables is intended for Paste and other
            setups that accumulate multiple component settings in a
            single dictionary. If config contains *no session. prefixed
            args*, then *all* of the config options will be used to
            intialize the Session objects.

        ``environ_key``
            Location where the Session instance will keyed in the WSGI
            environ

        ``**kwargs``
            All keyword arguments are assumed to be session settings and
            will override any settings found in ``config``

        TNzbeaker.session.id)Zinvalidate_corrupttypeZdata_dirkeytimeoutZsave_accessed_timeZsecretZlog_filezbeaker.session.zsession.Zsession_z?Session options should start with session. instead of session_.)dictr
items
startswithwarningswarnDeprecationWarningrrwrap_apprr)rr0rrrdctr%valrrrrOs*





zSessionMiddleware.__init__cst|f|j|dr4|djr4|d|j||j<|j|d<d|krld|jkrl|d|jd<dfdd	}|||S)Nzpaste.registryzbeaker.get_sessionzpaste.testing_variablesZwebtest_varnamecsJr>jddr>jdd}|r>|d|f|||S)N_headersZ
set_cookieZ
cookie_outz
Set-cookie)ZaccessedZpersist__dict__append)statusheadersexc_infoZcookie)sessionrrrsession_start_responsesz:SessionMiddleware.__call__.<locals>.session_start_response)N)	rr
rrrr9r_get_sessionr0)rrrr:r)r9rrrs



zSessionMiddleware.__call__cCstifddi|jS)NZuse_cookiesF)rr
)rrrrr;szSessionMiddleware._get_session)Nr#)rrr beaker_sessionr9rrr;rrrrr"Ls
:r"csfdd}|S)Ncst|fS)N)r")r)global_confrrrfiltersz&session_filter_factory.<locals>.filterr)r=rr>r)r=rrsession_filter_factorysr?cKst||f|S)N)r")rr=rrrrsession_filter_app_factorysr@)r-Zpaste.registryrr<r!Zbeaker.cacherZbeaker.sessionrrZbeaker.utilrrr	objectr
r"r?r@rrrr<module>s

;V