[session] drop session-as-a-context-manager
It made little sense in the 3.19 - session-as-cnx-bw-compat era, maybe.
Related to #1381328.
--- a/cubicweb/server/repository.py Thu Jun 12 18:37:29 2014 +0200
+++ b/cubicweb/server/repository.py Wed Mar 16 11:39:24 2016 +0100
@@ -691,12 +691,11 @@
Beware that unlike the older :meth:`internal_session`, internal
connections have all hooks beside security enabled.
"""
- with Session(InternalManager(), self) as session:
- with session.new_cnx() as cnx:
- cnx.user._cw = cnx # XXX remove when "vreg = user._cw.vreg"
- # hack in entity.py is gone
- with cnx.security_enabled(read=False, write=False):
- yield cnx
+ with Session(InternalManager(), self).new_cnx() as cnx:
+ cnx.user._cw = cnx # XXX remove when "vreg = user._cw.vreg"
+ # hack in entity.py is gone
+ with cnx.security_enabled(read=False, write=False):
+ yield cnx
def _get_session(self, sessionid, txid=None, checkshuttingdown=True):
"""return the session associated with the given session identifier"""
--- a/cubicweb/server/session.py Thu Jun 12 18:37:29 2014 +0200
+++ b/cubicweb/server/session.py Wed Mar 16 11:39:24 2016 +0100
@@ -1025,12 +1025,6 @@
self.closed = True
self.info('closed session %s for user %s', self.sessionid, self.user.login)
- def __enter__(self):
- return self
-
- def __exit__(self, *args):
- pass
-
def __unicode__(self):
return '<session %s (%s 0x%x)>' % (
unicode(self.user.login), self.sessionid, id(self))