#NEWLINE# def get_pool_for_host( self , host_id ) : #NEWLINE# #INDENT# 'Returns the connection pool for the given host.\n\n        This connection pool is used by the redis clients to make sure\n        that it does not have to reconnect constantly.  If you want to use\n        a custom redis client you can pass this in as connection pool\n        manually.\n        ' #NEWLINE# if isinstance ( host_id , HostInfo ) : #NEWLINE# #INDENT# host_info = host_id #NEWLINE# host_id = host_info . host_id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# host_info = self . hosts . get ( host_id ) #NEWLINE# if ( host_info is None ) : #NEWLINE# #INDENT# raise LookupError ( ( 'Host %r does not exist' % ( host_id , ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# rv = self . _pools . get ( host_id ) #NEWLINE# if ( rv is not None ) : #NEWLINE# #INDENT# return rv #NEWLINE# #UNINDENT# with self . _lock : #NEWLINE# #INDENT# rv = self . _pools . get ( host_id ) #NEWLINE# if ( rv is None ) : #NEWLINE# #INDENT# opts = dict ( ( self . pool_options or ( ) ) ) #NEWLINE# opts [ 'db' ] = host_info . db #NEWLINE# opts [ 'password' ] = host_info . password #NEWLINE# if ( host_info . unix_socket_path is not None ) : #NEWLINE# #INDENT# opts [ 'path' ] = host_info . unix_socket_path #NEWLINE# opts [ 'connection_class' ] = UnixDomainSocketConnection #NEWLINE# if k . ssl : #NEWLINE# #INDENT# raise TypeError ( 'SSL is not supported for unix domain sockets.' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# opts [ 'host' ] = host_info . host #NEWLINE# opts [ 'port' ] = host_info . port #NEWLINE# if host_info . ssl : #NEWLINE# #INDENT# if ( SSLConnection is None ) : #NEWLINE# #INDENT# raise TypeError ( 'This version of py-redis does not support SSL connections.' ) #NEWLINE# #UNINDENT# opts [ 'connection_class' ] = SSLConnection #NEWLINE# opts . update ( ( ( ( 'ssl_' + k ) , v ) for ( k , v ) in ( host_info . ssl_options or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . iteritems ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# rv = self . pool_cls ( ** opts ) #NEWLINE# self . _pools [ host_id ] = rv #NEWLINE# #UNINDENT# return rv