@@ -28,24 +28,21 @@ class Transaction(Batch):
2828 mutation, and execute those within a transaction::
2929
3030 >>> from gcloud import datastore
31- >>> from gcloud.datastore.transaction import Transaction
3231
33- >>> datastore.set_defaults()
34-
35- >>> with Transaction():
32+ >>> with datastore.Transaction():
3633 ... datastore.put([entity1, entity2])
3734
3835 Because it derives from :class:`Batch`, :class`Transaction` also provides
3936 :meth:`put` and :meth:`delete` methods::
4037
41- >>> with Transaction() as xact:
38+ >>> with datastore. Transaction() as xact:
4239 ... xact.put(entity1)
4340 ... xact.delete(entity2.key)
4441
4542 By default, the transaction is rolled back if the transaction block
4643 exits with an error::
4744
48- >>> with Transaction():
45+ >>> with datastore. Transaction():
4946 ... do_some_work()
5047 ... raise SomeException() # rolls back
5148
@@ -56,8 +53,8 @@ class Transaction(Batch):
5653 entities will not be available at save time! That means, if you
5754 try::
5855
59- >>> with Transaction():
60- ... entity = Entity(key=Key('Thing'))
56+ >>> with datastore. Transaction():
57+ ... entity = datastore. Entity(key=Key('Thing'))
6158 ... datastore.put([entity])
6259
6360 ``entity`` won't have a complete Key until the transaction is
@@ -66,8 +63,8 @@ class Transaction(Batch):
6663 Once you exit the transaction (or call ``commit()``), the
6764 automatically generated ID will be assigned to the entity::
6865
69- >>> with Transaction():
70- ... entity = Entity(key=Key('Thing'))
66+ >>> with datastore. Transaction():
67+ ... entity = datastore. Entity(key=Key('Thing'))
7168 ... datastore.put([entity])
7269 ... assert entity.key.is_partial # There is no ID on this key.
7370 ...
@@ -76,15 +73,15 @@ class Transaction(Batch):
7673 After completion, you can determine if a commit succeeded or failed.
7774 For example, trying to delete a key that doesn't exist::
7875
79- >>> with Transaction() as xact:
76+ >>> with datastore. Transaction() as xact:
8077 ... xact.delete(key)
8178 ...
8279 >>> xact.succeeded
8380 False
8481
8582 or successfully storing two entities:
8683
87- >>> with Transaction() as xact:
84+ >>> with datastore. Transaction() as xact:
8885 ... datastore.put([entity1, entity2])
8986 ...
9087 >>> xact.succeeded
@@ -93,10 +90,10 @@ class Transaction(Batch):
9390 If you don't want to use the context manager you can initialize a
9491 transaction manually::
9592
96- >>> transaction = Transaction()
93+ >>> transaction = datastore. Transaction()
9794 >>> transaction.begin()
9895
99- >>> entity = Entity(key=Key('Thing'))
96+ >>> entity = datastore. Entity(key=Key('Thing'))
10097 >>> transaction.put(entity)
10198
10299 >>> if error:
0 commit comments