# HG changeset patch # User Sylvain Thénault # Date 1489166609 -3600 # Node ID 85416b43310ae2ea108ded56cbb98d9b2afac66a # Parent 9056a41d91ba992a79a36d36c75d41e36a65ee88 [repo] Drop Session at last This is not used at all anymore. diff -r 9056a41d91ba -r 85416b43310a cubicweb/server/session.py --- a/cubicweb/server/session.py Fri Mar 10 18:21:22 2017 +0100 +++ b/cubicweb/server/session.py Fri Mar 10 18:23:29 2017 +0100 @@ -887,82 +887,6 @@ return self.vreg.schema.rschema(rtype).rdefs[(subjtype, objtype)] -def cnx_attr(attr_name, writable=False): - """return a property to forward attribute access to connection. - - This is to be used by session""" - args = {} - - @deprecated('[3.19] use a Connection object instead') - def attr_from_cnx(session): - return getattr(session._cnx, attr_name) - - args['fget'] = attr_from_cnx - if writable: - @deprecated('[3.19] use a Connection object instead') - def write_attr(session, value): - return setattr(session._cnx, attr_name, value) - args['fset'] = write_attr - return property(**args) - - -class Session(object): - """Repository user session - - This ties all together: - * session id, - * user, - * other session data. - """ - - def __init__(self, user, repo, _id=None): - self.user = user # XXX repoapi: deprecated and store only a login. - self.repo = repo - self.data = {} - - def __unicode__(self): - return '' % ( - unicode(self.user.login), id(self)) - - @property - def login(self): - return self.user.login - - def new_cnx(self): - """Return a new Connection object linked to the session - - The returned Connection will *not* be managed by the Session. - """ - return Connection(self) - - @deprecated('[3.19] use a Connection object instead') - def get_option_value(self, option, foreid=None): - if foreid is not None: - warn('[3.19] foreid argument is deprecated', DeprecationWarning, - stacklevel=2) - return self.repo.get_option_value(option) - - # deprecated ############################################################### - - @property - def anonymous_session(self): - # XXX for now, anonymous_user only exists in webconfig (and testconfig). - # It will only be present inside all-in-one instance. - # there is plan to move it down to global config. - if not hasattr(self.repo.config, 'anonymous_user'): - # not a web or test config, no anonymous user - return False - return self.user.login == self.repo.config.anonymous_user()[0] - - @deprecated('[3.13] use getattr(session.rtype_eids_rdef(rtype, eidfrom, eidto), prop)') - def schema_rproperty(self, rtype, eidfrom, eidto, rprop): - return getattr(self.rtype_eids_rdef(rtype, eidfrom, eidto), rprop) - - # these are overridden by set_log_methods below - # only defining here to prevent pylint from complaining - info = warning = error = critical = exception = debug = lambda msg, *a, **kw: None - - class InternalManager(object): """a manager user with all access rights used internally for task such as bootstrapping the repository or creating regular users according to @@ -1010,5 +934,4 @@ return None -set_log_methods(Session, getLogger('cubicweb.session')) set_log_methods(Connection, getLogger('cubicweb.session')) diff -r 9056a41d91ba -r 85416b43310a cubicweb/server/sqlutils.py --- a/cubicweb/server/sqlutils.py Fri Mar 10 18:21:22 2017 +0100 +++ b/cubicweb/server/sqlutils.py Fri Mar 10 18:23:29 2017 +0100 @@ -173,8 +173,8 @@ class ConnectionWrapper(object): - """handle connection to the system source, at some point associated to a - :class:`Session` + """Wrap a connection to the system source's database, attempting to handle + automatic reconnection. """ # since 3.19, we only have to manage the system source connection diff -r 9056a41d91ba -r 85416b43310a cubicweb/sobjects/services.py --- a/cubicweb/sobjects/services.py Fri Mar 10 18:21:22 2017 +0100 +++ b/cubicweb/sobjects/services.py Fri Mar 10 18:23:29 2017 +0100 @@ -83,11 +83,6 @@ lookupclasses = (AppObject, Union, ResultSet, CubicWebRequestBase) - try: - from cubicweb.server.session import Session, InternalSession - lookupclasses += (InternalSession, Session) - except ImportError: - pass # no server part installed results = {} counters, ocounters, garbage = gc_info(lookupclasses,