diff --git a/riak/datatypes/map.py b/riak/datatypes/map.py index 4ea64f67..a2bbdf2b 100644 --- a/riak/datatypes/map.py +++ b/riak/datatypes/map.py @@ -257,12 +257,15 @@ def modified(self): """ Whether the map has staged local modifications. """ - values_modified = [self._value[v].modified for v in self._value] - modified = (any(values_modified) or self._removes or self._updates) - if modified: + if self._removes: return True - else: - return False + for v in self._value: + if self._value[v].modified: + return True + for v in self._updates: + if self._updates[v].modified: + return True + return False def to_op(self): """ diff --git a/riak/tests/test_datatypes.py b/riak/tests/test_datatypes.py index 747de515..87ca1b20 100644 --- a/riak/tests/test_datatypes.py +++ b/riak/tests/test_datatypes.py @@ -122,6 +122,9 @@ def op(self, dtype): dtype.registers['b'].assign('testing') dtype.flags['c'].enable() dtype.maps['d'][('e', 'set')].add('deep value') + dtype.maps['f'].counters['g'] + dtype.maps['h'].maps['i'].flags['j'] + def check_op_output(self, op): self.assertIn(('update', ('a', 'counter'), ('increment', 2)), op) @@ -130,6 +133,9 @@ def check_op_output(self, op): self.assertIn(('update', ('d', 'map'), [('update', ('e', 'set'), {'adds': ['deep value']})]), op) + self.assertNotIn(('update', ('f', 'map'), None), op) + self.assertNotIn(('update', ('h', 'map'), [('update', ('i', 'map'), + None)]), op) def test_removes_require_context(self): dtype = self.dtype(self.bucket, 'key')