#NEWLINE# def get_default_connection( request , url = None , redis_client = StrictRedis , **redis_options ) : #NEWLINE# #INDENT# '\n    Default Redis connection handler. Once a connection is established it is\n    saved in `request.registry`.\n\n    Parameters:\n\n    ``request``\n    The current pyramid request object\n\n    ``url``\n    An optional connection string that will be passed straight to\n    `StrictRedis.from_url`. The connection string should be in the form:\n        redis://username:password@localhost:6379/0\n\n    ``settings``\n    A dict of keyword args to be passed straight to `StrictRedis`\n\n    Returns:\n\n    An instance of `StrictRedis`\n    ' #NEWLINE# redis = getattr ( request . registry , '_redis_sessions' , None ) #NEWLINE# if ( redis is not None ) : #NEWLINE# #INDENT# return redis #NEWLINE# #UNINDENT# if ( redis_options is not None ) : #NEWLINE# #INDENT# redis_options . pop ( 'password' , None ) #NEWLINE# redis_options . pop ( 'host' , None ) #NEWLINE# redis_options . pop ( 'port' , None ) #NEWLINE# redis_options . pop ( 'db' , None ) #NEWLINE# redis_options . pop ( 'unix_socket_path' , None ) #NEWLINE# redis_options . pop ( 'connection_pool' , None ) #NEWLINE# redis = redis_client . from_url ( url , ** redis_options ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# redis = redis_client ( ** redis_options ) #NEWLINE# #UNINDENT# setattr ( request . registry , '_redis_sessions' , redis ) #NEWLINE# return redis