Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #129: use transaction ID from connection's own transaction. #180

Merged
merged 2 commits into from
Sep 26, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Don't pass transaction ID to connection.rollback_transaction().
Feedback from @dhermes.
  • Loading branch information
tseaver committed Sep 25, 2014
commit d576000e3927a02fb6e113989ac7e123cc4210bf
8 changes: 4 additions & 4 deletions gcloud/datastore/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_rollback(self):
xact.begin()
xact.rollback()
self.assertEqual(xact.id(), None)
self.assertEqual(connection._rolled_back, (_DATASET, 234))
self.assertEqual(connection._rolled_back, _DATASET)
self.assertEqual(connection._xact, None)

def test_commit_no_auto_ids(self):
Expand Down Expand Up @@ -127,7 +127,7 @@ class Foo(Exception):
except Foo:
pass # XXX
#self.assertEqual(xact.id(), None)
#self.assertEqual(connection._rolled_back, (_DATASET, 234))
#self.assertEqual(connection._rolled_back, _DATASET))
#self.assertEqual(connection._xact, None)
# XXX should *not* have committed
self.assertEqual(connection._committed, (_DATASET, mutation))
Expand Down Expand Up @@ -167,8 +167,8 @@ def transaction(self, xact=_marker):
def begin_transaction(self, dataset_id):
self._begun = dataset_id
return self._xact_id
def rollback_transaction(self, dataset_id, xact_id):
self._rolled_back = (dataset_id, xact_id)
def rollback_transaction(self, dataset_id):
self._rolled_back = dataset_id
def commit(self, dataset_id, mutation):
self._committed = (dataset_id, mutation)
return self._commit_result
Expand Down
2 changes: 1 addition & 1 deletion gcloud/datastore/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def rollback(self):
- Sets the current connection's transaction reference to None.
- Sets the current transaction's ID to None.
"""
self.connection().rollback_transaction(self.dataset().id(), self.id())
self.connection().rollback_transaction(self.dataset().id())
self.connection().transaction(None)
self._id = None

Expand Down