From d442dab8189c156c1b5ad4b1380f558419308e74 Mon Sep 17 00:00:00 2001 From: NateBu Date: Thu, 18 Oct 2018 00:06:18 -0600 Subject: [PATCH 1/2] Preventing exception on dis/reconnection --- MeteorClient.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MeteorClient.py b/MeteorClient.py index d16d69f..cb6cc91 100644 --- a/MeteorClient.py +++ b/MeteorClient.py @@ -21,14 +21,16 @@ def add_data(self, collection, id, fields): self.data[collection][id] = {} for key, value in fields.items(): self.data[collection][id][key] = value - + def change_data(self, collection, id, fields, cleared): for key, value in fields.items(): - self.data[collection][id][key] = value + if collection in self.data and id in self.data[collection]: + self.data[collection][id][key] = value for key in cleared: - del self.data[collection][id][key] - + if collection in self.data and id in self.data[collection] and key in self.data[collection][id]: + del self.data[collection][id][key] + def remove_data(self, collection, id): del self.data[collection][id] From f6d4a4c1879fa49887b187c3626ce0e3ef4b137a Mon Sep 17 00:00:00 2001 From: NateBu Date: Tue, 12 Feb 2019 17:50:14 -0700 Subject: [PATCH 2/2] no change --- MeteorClient.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MeteorClient.py b/MeteorClient.py index cb6cc91..d44af2c 100644 --- a/MeteorClient.py +++ b/MeteorClient.py @@ -21,7 +21,7 @@ def add_data(self, collection, id, fields): self.data[collection][id] = {} for key, value in fields.items(): self.data[collection][id][key] = value - + def change_data(self, collection, id, fields, cleared): for key, value in fields.items(): if collection in self.data and id in self.data[collection]: @@ -29,8 +29,8 @@ def change_data(self, collection, id, fields, cleared): for key in cleared: if collection in self.data and id in self.data[collection] and key in self.data[collection][id]: - del self.data[collection][id][key] - + del self.data[collection][id][key] + def remove_data(self, collection, id): del self.data[collection][id]