[connection] Connection.execute touch Session timestamp
This allow to keep Session alive while using Connection object only for database
access.
--- 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