retrieve session data in a single query
instead of two (one for the session object, the other for its cwsessiondata attribute).
--- a/pyramid_cubicweb/session.py Tue Jun 28 09:07:12 2016 +0200
+++ b/pyramid_cubicweb/session.py Fri Jun 03 17:59:49 2016 +0200
@@ -96,8 +96,9 @@
return
with self.repo.internal_cnx() as cnx:
- session = cnx.find('CWSession', eid=self.sessioneid).one()
- value = session.cwsessiondata
+ value_rset = cnx.execute('Any D WHERE X eid %(x)s, X cwsessiondata D',
+ {'x': self.sessioneid})
+ value = value_rset[0][0]
if value:
# Use directly dict.update to avoir _set_accessed to be
# recursively called