Merge branch '547'
Conflicts: cassandra/__init__.py
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
3.2.2
|
||||
=====
|
||||
April 19, 2016
|
||||
|
||||
* Fix counter save-after-no-update (PYTHON-547)
|
||||
|
||||
3.2.1
|
||||
=====
|
||||
April 13, 2016
|
||||
|
||||
* Introduced an update to allow deserializer compilation with recently released Cython 0.24
|
||||
* Introduced an update to allow deserializer compilation with recently released Cython 0.24 (PYTHON-542)
|
||||
|
||||
3.2.0
|
||||
=====
|
||||
|
||||
@@ -22,7 +22,7 @@ class NullHandler(logging.Handler):
|
||||
|
||||
logging.getLogger('cassandra').addHandler(NullHandler())
|
||||
|
||||
__version_info__ = (3, 2, 1, 'post0')
|
||||
__version_info__ = (3, 2, 2, 'post0')
|
||||
__version__ = '.'.join(map(str, __version_info__))
|
||||
|
||||
|
||||
|
||||
@@ -804,7 +804,7 @@ class UpdateStatement(AssignmentStatement):
|
||||
previous = column.to_database(previous)
|
||||
clause = container_update_type(column.db_field_name, value, operation, previous)
|
||||
elif col_type == columns.Counter:
|
||||
clause = CounterUpdateClause(column.db_field_name, value)
|
||||
clause = CounterUpdateClause(column.db_field_name, value, previous)
|
||||
else:
|
||||
clause = AssignmentClause(column.db_field_name, value)
|
||||
if clause.get_context_size(): # this is to exclude map removals from updates. Can go away if we drop support for C* < 1.2.4 and remove two-phase updates
|
||||
|
||||
@@ -112,3 +112,19 @@ class TestCounterColumn(BaseCassEngTestCase):
|
||||
instance = TestCounterModel()
|
||||
assert instance.counter == 0
|
||||
|
||||
def test_save_after_no_update(self):
|
||||
expected_value = 15
|
||||
instance = TestCounterModel.create()
|
||||
instance.update(counter=expected_value)
|
||||
|
||||
# read back
|
||||
instance = TestCounterModel.get(partition=instance.partition)
|
||||
self.assertEqual(instance.counter, expected_value)
|
||||
|
||||
# save after doing nothing
|
||||
instance.save()
|
||||
self.assertEqual(instance.counter, expected_value)
|
||||
|
||||
# make sure there was no increment
|
||||
instance = TestCounterModel.get(partition=instance.partition)
|
||||
self.assertEqual(instance.counter, expected_value)
|
||||
|
||||
Reference in New Issue
Block a user