<s> """<STR_LIT>""" <EOL> import threading <EOL> class _RequestConfig ( object ) : <EOL> """<STR_LIT>""" <EOL> __shared_state = threading . local ( ) <EOL> def __getattr__ ( self , name ) : <EOL> return getattr ( self . __shared_state , name ) <EOL> def __setattr__ ( self , name , value ) : <EOL> """<STR_LIT>""" <EOL> if name == '<STR_LIT>' : <EOL> self . load_wsgi_environ ( value ) <EOL> return self . __shared_state . __setattr__ ( name , value ) <EOL> return self . __shared_state . __setattr__ ( name , value ) <EOL> def __delattr__ ( self , name ) : <EOL> delattr ( self . __shared_state , name ) <EOL> def load_wsgi_environ ( self , environ ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in environ or environ . get ( '<STR_LIT>' ) == '<STR_LIT>' or environ . get ( '<STR_LIT>' ) == '<STR_LIT>' : <EOL> self . __shared_state . protocol = '<STR_LIT>' <EOL> else : <EOL> self . __shared_state . protocol = '<STR_LIT:http>' <EOL> try : <EOL> self . mapper . environ = environ <EOL> except AttributeError : <EOL> pass <EOL> try : <EOL> if '<STR_LIT>' in environ : <EOL> mapper = self . mapper <EOL> path = environ [ '<STR_LIT>' ] <EOL> result = mapper . routematch ( path ) <EOL> if result is not None : <EOL> self . __shared_state . mapper_dict = result [ <NUM_LIT:0> ] <EOL> self . __shared_state . route = result [ <NUM_LIT:1> ] <EOL> else : <EOL> self . __shared_state . mapper_dict = None <EOL> self . __shared_state . route = None <EOL> except AttributeError : <EOL> pass <EOL> if '<STR_LIT>' in environ : <EOL> self . __shared_state . host = environ [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002CU+0020>' , <NUM_LIT:1> ) [ <NUM_LIT:0> ] <EOL> elif '<STR_LIT>' in environ : <EOL> self . __shared_state . host = environ [ '<STR_LIT>' ] <EOL> else : <EOL> self . __shared_state . host = environ [ '<STR_LIT>' ] <EOL> if environ [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> if environ [ '<STR_LIT>' ] != '<STR_LIT>' : <EOL> self . __shared_state . host += '<STR_LIT::>' + environ [ '<STR_LIT>' ] <EOL> else : <EOL> if environ [ '<STR_LIT>' ] != '<STR_LIT>' : <EOL> self . __shared_state . host += '<STR_LIT::>' + environ [ '<STR_LIT>' ] <EOL> def request_config ( original = False ) : <EOL> """<STR_LIT>""" <EOL> obj = _RequestConfig ( ) <EOL> try : <EOL> if obj . request_local and original is False : <EOL> return getattr ( obj , '<STR_LIT>' ) ( ) <EOL> except AttributeError : <EOL> obj . request_local = False <EOL> obj . using_request_local = False <EOL> return _RequestConfig ( ) <EOL> from routes . mapper import Mapper <EOL> from routes . util import redirect_to , url_for , URLGenerator <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] </s>
