Mercurial > hg > RemoteViewer
changeset 17:58bfa3d9f5a9
fix initialization in case the connections array has not been initialized
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 25 Sep 2014 01:29:00 +0200 |
parents | 6a62de088c00 |
children | 4f8e85589dae |
files | RemoteViewer/Settings.py |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/RemoteViewer/Settings.py Wed Sep 24 03:51:33 2014 +0200 +++ b/RemoteViewer/Settings.py Thu Sep 25 01:29:00 2014 +0200 @@ -22,11 +22,20 @@ connections = self.config[CONNECTIONS_KEY] if connections is not None: return connections - return [] + else: + return self.__initConnections() + else: + return self.__initConnections() + + def __initConnections(self): + connections = [] + self.config[CONNECTIONS_KEY] = connections + return connections def addConnection(self, connection): + connections = self.__connections() json = connection.toJson() - self.config[CONNECTIONS_KEY].append(json) + connections.append(json) self.persist() def update(self, connection):