server/session.py
changeset 8433 ff9d6d269877
parent 8367 fc59d2380c48
child 8525 c09feae04094
child 8529 1daea1f433c9
--- a/server/session.py	Thu May 31 18:07:46 2012 +0200
+++ b/server/session.py	Wed Jun 06 10:26:34 2012 +0200
@@ -1275,6 +1275,12 @@
         if not safe:
             self.disable_hook_categories('integrity')
 
+    def __enter__(self):
+        return self
+
+    def __exit__(self, exctype, excvalue, tb):
+        self.close()
+
     @property
     def cnxset(self):
         """connections set, set according to transaction mode for each query"""