Alex Lourie has uploaded a new change for review.
Change subject: core: Updated Transaction _enter_ method
......................................................................
core: Updated Transaction _enter_ method
This patch updates the Transaction class method
_enter_ by adding a return of 'self'. This allows
using the Transaction object in a context manager
in a following way:
from otopi import transaction
with transaction.Transaction() as mytransaction:
mytransaction.<class methods or objects>
Change-Id: I83825d6f92e029ba6acec7ab0387a18370a55ee5
Signed-off-by: Alex Lourie <[email protected]>
---
M src/otopi/transaction.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/43/15343/1
diff --git a/src/otopi/transaction.py b/src/otopi/transaction.py
index 2e6dff1..3cdd641 100644
--- a/src/otopi/transaction.py
+++ b/src/otopi/transaction.py
@@ -157,6 +157,7 @@
def __enter__(self):
self.prepare()
+ return self
def __exit__(self, exc_type, exc_value, traceback):
if exc_type is None:
--
To view, visit http://gerrit.ovirt.org/15343
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I83825d6f92e029ba6acec7ab0387a18370a55ee5
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches