Пример #1
0
 def test_connection(self, data):
     conn = Connection(None, data)
     try:
         conn.open()
         return True
     except Exception as err:
         return str(err).strip()
Пример #2
0
 def test_connection(self, data):
     conn = Connection(None, data)
     try:
         conn.open()
         return True
     except Exception as err:
         return str(err).strip()
Пример #3
0
 def update_connections(self):
     if not os.path.exists(CONNECTIONS_FILE):
         return
     with open(CONNECTIONS_FILE) as f:
         data = json.load(f)
     for key in data:
         if key in self._connections:
             self._connections[key].update_config(data[key])
         else:
             config = data[key].copy()
             password = keyring.get_password('runsqlrun', key)
             if password is not None:
                 config['password'] = password
             conn = Connection(key, config)
             self._connections[key] = conn
             conn.start()
     # remove deleted connections
     for key in list(self._connections):
         if key not in data:
             conn = self._connections.pop(key)
             conn.keep_running = False
             conn.join()
             self.emit('connection-deleted', conn.key)
Пример #4
0
 def update_connections(self):
     if not os.path.exists(CONNECTIONS_FILE):
         return
     with open(CONNECTIONS_FILE) as f:
         data = json.load(f)
     for key in data:
         if key in self._connections:
             self._connections[key].update_config(data[key])
         else:
             config = data[key].copy()
             password = keyring.get_password('runsqlrun', key)
             if password is not None:
                 config['password'] = password
             conn = Connection(key, config)
             self._connections[key] = conn
             conn.start()
     # remove deleted connections
     for key in list(self._connections):
         if key not in data:
             conn = self._connections.pop(key)
             conn.keep_running = False
             conn.join()
             self.emit('connection-deleted', conn.key)