%PDF- %PDF-
Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/ |
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/config.pyo |
� a�Nc @ s d Z d d l m Z m Z d d d g Z d e f d � � YZ e � Z e � Z d e f d � � YZ d � Z e j Z d S( s* Paste Configuration Middleware and Objectsi����( t RegistryManagert StackedObjectProxyt DispatchingConfigt CONFIGt ConfigMiddlewarec B s` e Z d Z d d � Z d � Z d d � Z d � Z d d � Z d � Z d � Z e Z Z RS( s This is a configuration object that can be used globally, imported, have references held onto. The configuration may differ by thread (or may not). Specific configurations are registered (and deregistered) either for the process or for threads. R c C s* t t | � j d | � g | j d <d S( Nt namet _process_configs( t superR t __init__t __dict__( t selfR ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyR s c C s | j | � d S( s� Make ``conf`` the active configuration for this thread. Thread-local configuration always overrides process-wide configuration. This should be used like:: conf = make_conf() dispatching_config.push_thread_config(conf) try: ... do stuff ... finally: dispatching_config.pop_thread_config(conf) N( t _push_object( R t conf( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyt push_thread_config s c C s | j | � d S( s� Remove a thread-local configuration. If ``conf`` is given, it is checked against the popped configuration and an error is emitted if they don't match. N( t _pop_object( R R ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyt pop_thread_config+ s c C s | j j | � d S( sg Like push_thread_config, but applies the configuration to the entire process. N( R t append( R R ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyt push_process_config3 s c C s | j | j | � d S( N( t _pop_fromR ( R R ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyt pop_process_config: s c C sA | j � } | d k r= | | k r= t d | | f � � n d S( NsB The config popped (%s) is not the same as the config expected (%s)( t popt Nonet AssertionError( R t lstR t popped( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyR = s c C sO y t t | � j � SWn1 t k rJ | j r; | j d St d � � n Xd S( Ni����s? No configuration has been registered for this process or thread( R R t _current_objt TypeErrorR t AttributeError( R ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyR E s N( t __name__t __module__t __doc__R R R R R R R R t currentt current_conf( ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyR s c B s e Z d Z e d d � Z RS( s A WSGI middleware that adds a ``paste.config`` key (by default) to the request environment, as well as registering the configuration temporarily (for the length of the request) with ``paste.config.CONFIG`` (or any other ``DispatchingConfig`` object). s paste.configc s5 � � � � f d � } t | j | � j | � d S( sv This delegates all requests to `application`, adding a *copy* of the configuration `config`. c s~ | j � t � } � j � } | � <| d j � | � z � | | � } Wd | t k ro | j � d � n | | � <X| S( Ns paste.registry( t gett no_configt copyt registerR R ( t environt start_responset popped_configt current_configt app_iter( t applicationt configt dispatching_configt environ_key( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyt register_configb s N( R t __class__R ( R R* R+ R, R- R. ( ( R* R+ R, R- s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyR \ s ( R R R R R ( ( ( s= /opt/alt/python27/lib/python2.7/site-packages/paste/config.pyR S s c K s&