src/ztfy/utils/zodb.py
branchZTK-1.1
changeset 181 3bdaee25ec3a
parent 179 612a350cc660
child 242 ffa98c18e909
--- a/src/ztfy/utils/zodb.py	Thu Oct 18 23:44:25 2012 +0200
+++ b/src/ztfy/utils/zodb.py	Fri Oct 19 09:56:41 2012 +0200
@@ -41,7 +41,11 @@
 
 
 class ZEOConnectionInfo(object):
-    """ZEO connection info"""
+    """ZEO connection info
+    
+    Provides a context manager which directly returns
+    ZEO connection root
+    """
 
     implements(IZEOConnection)
 
@@ -87,10 +91,11 @@
     def connection(self):
         return self._connection
 
+    # Context management methods
     def __enter__(self):
         self._storage, self._db = self.getConnection(get_storage=True)
         self._connection = self._db.open()
-        return self
+        return self._connection.root()
 
     def __exit__(self, exc_type, exc_value, traceback):
         if self._connection is not None: