From 7bfebdd4babeca3b3ff40380f84332d1d7a69904 Mon Sep 17 00:00:00 2001 From: Stefan Midjich Date: Fri, 29 Sep 2017 19:01:27 +0200 Subject: [PATCH] cleanup --- tools/client.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/client.py b/tools/client.py index c80e525..ae99855 100644 --- a/tools/client.py +++ b/tools/client.py @@ -27,21 +27,23 @@ class Client(object): # found. if client_data is None: raise StorageNotFound('Client not found') + else: + # Next try to get an existing client by IP and protocol + self.ip_address = kw.pop('ip_address') + self.protocol = kw.pop('protocol') - # Next try to get an existing client by IP and protocol - self.ip_address = kw.pop('ip_address') - self.protocol = kw.pop('protocol') - - if self.ip_address and self.protocol: - client_data = self.storage.get_client( - self._ip_address, - self.protocol - ) + if self.ip_address and self.protocol: + client_data = self.storage.get_client( + self._ip_address, + self.protocol + ) if client_data: self.load_client(client_data) else: self.client_id = str(uuid4()) + self.ip_address = kw.pop('ip_address') + self.protocol = kw.pop('protocol') self.created = datetime.now() self.enabled = False self.last_packets = 0