[repo] Drop _get_session method
it's not actually necessary but holds underlying _sessions dict handling.
Drop backward compat relying on it (which IMO should not be a problem).
Drop import of unused QueryError along the way.
--- a/cubicweb/dataimport/stores.py Thu Mar 09 18:02:16 2017 +0100
+++ b/cubicweb/dataimport/stores.py Fri Mar 10 11:55:16 2017 +0100
@@ -149,11 +149,6 @@
def commit(self):
return self._commit()
- @property
- def session(self):
- warnings.warn('[3.19] deprecated property.', DeprecationWarning, stacklevel=2)
- return self._cnx.repo._get_session(self._cnx.sessionid)
-
@deprecated("[3.19] use cnx.find(*args, **kwargs).entities() instead")
def find_entities(self, *args, **kwargs):
return self._cnx.find(*args, **kwargs).entities()
--- a/cubicweb/hooks/syncsession.py Thu Mar 09 18:02:16 2017 +0100
+++ b/cubicweb/hooks/syncsession.py Fri Mar 10 11:55:16 2017 +0100
@@ -118,7 +118,7 @@
# remove cached groups for the user
key = user_session_cache_key(self.session.user.eid, 'groups')
self.session.data.pop(key, None)
- self.session.repo.close(self.session.sessionid)
+ self.session.close()
except BadConnectionId:
pass # already closed
--- a/cubicweb/server/migractions.py Thu Mar 09 18:02:16 2017 +0100
+++ b/cubicweb/server/migractions.py Fri Mar 10 11:55:16 2017 +0100
@@ -154,7 +154,7 @@
except (KeyboardInterrupt, EOFError):
print('aborting...')
sys.exit(0)
- self.session = self.repo._get_session(self.cnx.sessionid)
+ self.session = self.cnx.session
def cube_upgraded(self, cube, version):
self.cmd_set_property('system.version.%s' % cube.lower(),
--- a/cubicweb/server/repository.py Thu Mar 09 18:02:16 2017 +0100
+++ b/cubicweb/server/repository.py Fri Mar 10 11:55:16 2017 +0100
@@ -48,7 +48,7 @@
UniqueTogetherError, onevent, ViolatedConstraint)
from cubicweb import set_log_methods
from cubicweb import cwvreg, schema, server
-from cubicweb.server import ShuttingDown, utils, hook, querier, sources
+from cubicweb.server import utils, hook, querier, sources
from cubicweb.server.session import Session, InternalManager
@@ -700,10 +700,6 @@
def connect(self, login, **kwargs):
return self.new_session(login, **kwargs).sessionid
- @deprecated('[3.23] use session.close() directly')
- def close(self, sessionid):
- self._get_session(sessionid).close()
-
# session handling ########################################################
def close_sessions(self):
@@ -738,16 +734,6 @@
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"""
- if checkshuttingdown and self.shutting_down:
- raise ShuttingDown('Repository is shutting down')
- try:
- session = self._sessions[sessionid]
- except KeyError:
- raise BadConnectionId('No such session %s' % sessionid)
- return session
-
# data sources handling ###################################################
# * correspondance between eid and type
# * correspondance between eid and local id (i.e. specific to a given source)