Skip to content

Commit

Permalink
Bug fix: return layer despite it was not possible to remove item of l…
Browse files Browse the repository at this point in the history
…ayer.
  • Loading branch information
Jiri Hnidek committed Jan 13, 2015
1 parent c6de2e4 commit be28a53
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions vrsent/verse_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ def cb_receive_layer_destroy(cls, session, node_id, layer_id):
try:
node = session.nodes[node_id]
except KeyError:
return
return None
# Try to find the layer
try:
layer = node.layers[layer_id]
except KeyError:
return
return None
# Destroy layer and child layers
layer.cb_receive_destroy()

Expand All @@ -361,12 +361,12 @@ def cb_receive_layer_set_value(cls, session, node_id, layer_id, item_id, value):
try:
node = session.nodes[node_id]
except KeyError:
return
return None
# Try to find the layer
try:
layer = node.layers[layer_id]
except KeyError:
return
return None
# Set item value, but do not send command to verse server
layer.send_cmds = False
layer.items[item_id] = value
Expand All @@ -377,24 +377,25 @@ def cb_receive_layer_set_value(cls, session, node_id, layer_id, item_id, value):
@classmethod
def cb_receive_layer_unset_value(cls, session, node_id, layer_id, item_id):
"""
Static method of class that set value of item in layer
Static method of class that unset value of item in layer
"""

# Try to find node
try:
node = session.nodes[node_id]
except KeyError:
return
return None
# Try to find the layer
try:
layer = node.layers[layer_id]
except KeyError:
return
return None
# UnSet item value
try:
layer.items.pop(item_id)
except KeyError:
return
# When item was not found, then return layer
pass

return layer

Expand Down

0 comments on commit be28a53

Please sign in to comment.