Skip to content

Commit 0f0e90f

Browse files
committed
Merge branch '547'
Conflicts: cassandra/__init__.py
2 parents 3436cd5 + f42c26d commit 0f0e90f

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

CHANGELOG.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
3.2.2
2+
=====
3+
April 19, 2016
4+
5+
* Fix counter save-after-no-update (PYTHON-547)
6+
17
3.2.1
28
=====
39
April 13, 2016
410

5-
* Introduced an update to allow deserializer compilation with recently released Cython 0.24
11+
* Introduced an update to allow deserializer compilation with recently released Cython 0.24 (PYTHON-542)
612

713
3.2.0
814
=====

cassandra/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def emit(self, record):
2222

2323
logging.getLogger('cassandra').addHandler(NullHandler())
2424

25-
__version_info__ = (3, 2, 1, 'post0')
25+
__version_info__ = (3, 2, 2, 'post0')
2626
__version__ = '.'.join(map(str, __version_info__))
2727

2828

cassandra/cqlengine/statements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ def add_update(self, column, value, operation=None, previous=None):
804804
previous = column.to_database(previous)
805805
clause = container_update_type(column.db_field_name, value, operation, previous)
806806
elif col_type == columns.Counter:
807-
clause = CounterUpdateClause(column.db_field_name, value)
807+
clause = CounterUpdateClause(column.db_field_name, value, previous)
808808
else:
809809
clause = AssignmentClause(column.db_field_name, value)
810810
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

tests/integration/cqlengine/columns/test_counter_column.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,19 @@ def test_new_instance_defaults_to_zero(self):
112112
instance = TestCounterModel()
113113
assert instance.counter == 0
114114

115+
def test_save_after_no_update(self):
116+
expected_value = 15
117+
instance = TestCounterModel.create()
118+
instance.update(counter=expected_value)
119+
120+
# read back
121+
instance = TestCounterModel.get(partition=instance.partition)
122+
self.assertEqual(instance.counter, expected_value)
123+
124+
# save after doing nothing
125+
instance.save()
126+
self.assertEqual(instance.counter, expected_value)
127+
128+
# make sure there was no increment
129+
instance = TestCounterModel.get(partition=instance.partition)
130+
self.assertEqual(instance.counter, expected_value)

0 commit comments

Comments
 (0)