[transaction] relocate method building transaction context manager
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 22 Mar 2013 19:32:25 +0100
changeset 8770 2005dcc6150e
parent 8769 1672502ac204
child 8771 519629422391
[transaction] relocate method building transaction context manager It is in the middle of methods going to be refactored.
server/session.py
--- a/server/session.py	Fri Mar 22 18:49:48 2013 +0100
+++ b/server/session.py	Fri Mar 22 19:32:25 2013 +0100
@@ -393,16 +393,6 @@
         return '<session %s (%s 0x%x)>' % (
             unicode(self.user.login), self.id, id(self))
 
-    def transaction(self, free_cnxset=True):
-        """return context manager to enter a transaction for the session: when
-        exiting the `with` block on exception, call `session.rollback()`, else
-        call `session.commit()` on normal exit.
-
-        The `free_cnxset` will be given to rollback/commit methods to indicate
-        wether the connections set should be freed or not.
-        """
-        return transaction(self, free_cnxset)
-
     def set_tx_data(self, txid=None):
         if txid is None:
             txid = threading.currentThread().getName()
@@ -424,6 +414,17 @@
     def get_option_value(self, option, foreid=None):
         return self.repo.get_option_value(option, foreid)
 
+    def transaction(self, free_cnxset=True):
+        """return context manager to enter a transaction for the session: when
+        exiting the `with` block on exception, call `session.rollback()`, else
+        call `session.commit()` on normal exit.
+
+        The `free_cnxset` will be given to rollback/commit methods to indicate
+        wether the connections set should be freed or not.
+        """
+        return transaction(self, free_cnxset)
+
+
     def hijack_user(self, user):
         """return a fake request/session using specified user"""
         session = Session(user, self.repo)