#NEWLINE# def _ensure_is_connected( self ) : #NEWLINE# #INDENT# if ( not self . _is_connected ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# port = int ( self . settings_dict [ 'PORT' ] ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# raise ImproperlyConfigured ( 'PORT must be an integer' ) #NEWLINE# #UNINDENT# self . db_name = self . settings_dict [ 'NAME' ] #NEWLINE# self . _connection = ES ( ( '%s:%s' % ( self . settings_dict [ 'HOST' ] , port ) ) , decoder = Decoder , encoder = Encoder , autorefresh = True , default_indices = [ self . db_name ] ) #NEWLINE# self . _db_connection = self . _connection #NEWLINE# try : #NEWLINE# #INDENT# self . _connection . create_index ( port . db_name ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . _is_connected = True