#NEWLINE# def get_query_server_config( server = None ) : #NEWLINE# #INDENT# if ( ( not server ) or ( server not in DATABASES ) ) : #NEWLINE# #INDENT# keys = DATABASES . keys ( ) #NEWLINE# name = ( ( keys and keys [ 0 ] ) or None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# name = query_server #NEWLINE# #UNINDENT# if name : #NEWLINE# #INDENT# query_server = { #NEWLINE# #INDENT# 'server_name' : DATABASES [ name ] . ENGINE . get ( ) . split ( '.' ) [ ( - 1 ) ] , #NEWLINE# 'server_host' : DATABASES [ name ] . HOST . get ( ) , #NEWLINE# 'server_port' : DATABASES [ name ] . PORT . get ( ) , #NEWLINE# 'username' : DATABASES [ name ] . USER . get ( ) , #NEWLINE# 'password' : get_database_password ( name ) , #NEWLINE# 'options' : force_dict_to_strings ( DATABASES [ name ] . OPTIONS . get ( ) ) , #NEWLINE# 'alias' : name , #NEWLINE# #UNINDENT# } #NEWLINE# if DATABASES [ name ] . NAME . get ( ) : #NEWLINE# #INDENT# query_server [ 'name' ] = DATABASES [ name ] . NAME . get ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# query_server = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# LOG . debug ( ( 'Query Server: %s' % query_server ) ) #NEWLINE# return query_server