# HG changeset patch # User Aurelien Campeas # Date 1458124764 -3600 # Node ID 71057a8bb19afd9a4984ea2eaeec863de8062459 # Parent e5d065f612e87aed9bfaddcd0fa8ef141ad658e2 [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. diff -r e5d065f612e8 -r 71057a8bb19a cubicweb/server/repository.py --- 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""" diff -r e5d065f612e8 -r 71057a8bb19a cubicweb/server/session.py --- 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 '' % ( unicode(self.user.login), self.sessionid, id(self))