#NEWLINE# def connect( self , name , prefix , create ) : #NEWLINE# #INDENT# name = u ( name ) #NEWLINE# try : #NEWLINE# #INDENT# uid = self . databases . connect ( name , prefix , create ) #NEWLINE# resp = protocol . msg . format_response ( uid , status = protocol . status . OK ) #NEWLINE# #UNINDENT# except self . databases . NotExistError as e : #NEWLINE# #INDENT# self . logger . warning ( 'No such database: {}' , name ) #NEWLINE# resp = protocol . msg . format_response ( name , status = protocol . status . DB_NOT_FOUND ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . logger . warning ( "Error opening database '{}': {}" , name , e ) #NEWLINE# resp = protocol . msg . format_response ( name , status = protocol . status . DB_ERROR ) #NEWLINE# #UNINDENT# return resp