remove nesting

This commit is contained in:
j 2016-03-23 20:15:26 +01:00
parent 0401f76621
commit 6f5deada62

View file

@ -122,16 +122,15 @@ class LocalNodes(dict):
for key, value in info.properties.items(): for key, value in info.properties.items():
key = key.decode() key = key.decode()
self[id][key] = value.decode() self[id][key] = value.decode()
logger.debug('add localnode: %s', self[id]) logger.debug('add: %s', self[id])
if state.tasks: if state.tasks:
state.tasks.queue('addlocalinfo', self[id]) state.tasks.queue('addlocalinfo', self[id])
elif state_change is ServiceStateChange.Removed: elif state_change is ServiceStateChange.Removed:
logger.debug('remove localnode: %s', id) logger.debug('remove: %s', id)
self.pop(id, None) self.pop(id, None)
if state.tasks: if state.tasks:
state.tasks.queue('removelocalinfo', id) state.tasks.queue('removelocalinfo', id)
def get(self, user_id): def get(self, user_id):
if user_id in self: if user_id in self and can_connect(self[user_id]):
if can_connect(self[user_id]): return self[user_id]
return self[user_id]