# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1372324814 -7200
# Node ID b4c12d2873f63d4b3ae7b9fdae0eaa46f3d8341c
# Parent  04ceb4268b3bfa19631d277b6a92cba59e329a2c
[connection] Connection.execute touch Session timestamp

This allow to keep Session alive while using Connection object only for database
access.

diff -r 04ceb4268b3b -r b4c12d2873f6 server/session.py
--- a/server/session.py	Tue Jun 25 17:42:12 2013 +0200
+++ b/server/session.py	Thu Jun 27 11:20:14 2013 +0200
@@ -431,6 +431,9 @@
         self.vreg = self.repo.vreg
         self._execute = self.repo.querier.execute
 
+        # other session utility
+        self._session_timestamp = session._timestamp
+
         #: connection handling mode
         self.mode = session.default_mode
         #: connection set used to execute queries on sources
@@ -477,6 +480,7 @@
         else:
             self._set_user(session.user)
 
+
     # shared data handling ###################################################
 
     @property
@@ -883,11 +887,13 @@
 
         See :meth:`cubicweb.dbapi.Cursor.execute` documentation.
         """
+        self._session_timestamp.touch()
         if eid_key is not None:
             warn('[3.8] eid_key is deprecated, you can safely remove this argument',
                  DeprecationWarning, stacklevel=2)
         rset = self._execute(self, rql, kwargs, build_descr)
         rset.req = self
+        self._session_timestamp.touch()
         return rset
 
     # resource accessors ######################################################
@@ -1302,7 +1308,6 @@
 
         See :meth:`cubicweb.dbapi.Cursor.execute` documentation.
         """
-        self._timestamp.touch() # update timestamp
         rset = self._cnx.execute(*args, **kwargs)
         rset.req = self
         return rset