[session] gather close_cnx with get_cnx and set_cnx
They do the same kind of operation and deserve to be grouped together.
--- a/server/session.py Thu Jun 27 11:13:18 2013 +0200
+++ b/server/session.py Wed Jun 26 11:39:01 2013 +0200
@@ -1304,6 +1304,14 @@
self._cnxs[cnxid] = cnx
return cnx
+ def close_cnx(self, cnxid):
+ """Close a Connection related to a session"""
+ cnx = self._cnxs.get(cnxid, None)
+ if cnx is not None:
+ cnx.free_cnxset(ignoremode=True)
+ self._clear_thread_storage(cnx)
+ self._clear_cnx_storage(cnx)
+
def set_cnx(self, cnxid=None):
"""set the default connection of the current thread to <cnxid>
@@ -1489,14 +1497,6 @@
rset.req = self
return rset
- def close_cnx(self, cnxid):
- cnx = self._cnxs.get(cnxid, None)
- if cnx is not None:
- cnx.free_cnxset(ignoremode=True)
- self._clear_thread_storage(cnx)
- self._clear_cnx_storage(cnx)
-
-
def _clear_thread_data(self, free_cnxset=True):
"""remove everything from the thread local storage, except connections set
which is explicitly removed by free_cnxset, and mode which is set anyway