# HG changeset patch # User Pierre-Yves David # Date 1372239541 -7200 # Node ID c9ed52e535263aaed90b80abed935181b99b2b98 # Parent e6d1df61994954f0087eb2ee62278f9119936946 [session] gather close_cnx with get_cnx and set_cnx They do the same kind of operation and deserve to be grouped together. diff -r e6d1df619949 -r c9ed52e53526 server/session.py --- 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 @@ -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