From 6f5deada62fdf4f06849eab6698ca7e501082ae0 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 23 Mar 2016 20:15:26 +0100 Subject: [PATCH] remove nesting --- oml/localnodes.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/oml/localnodes.py b/oml/localnodes.py index f3e3ccb..a17a903 100644 --- a/oml/localnodes.py +++ b/oml/localnodes.py @@ -122,16 +122,15 @@ class LocalNodes(dict): for key, value in info.properties.items(): key = key.decode() self[id][key] = value.decode() - logger.debug('add localnode: %s', self[id]) + logger.debug('add: %s', self[id]) if state.tasks: state.tasks.queue('addlocalinfo', self[id]) elif state_change is ServiceStateChange.Removed: - logger.debug('remove localnode: %s', id) + logger.debug('remove: %s', id) self.pop(id, None) if state.tasks: state.tasks.queue('removelocalinfo', id) def get(self, user_id): - if user_id in self: - if can_connect(self[user_id]): - return self[user_id] + if user_id in self and can_connect(self[user_id]): + return self[user_id]