minor fixes

This commit is contained in:
Tomas Kopecek 2022-12-01 13:49:50 +01:00
parent 906958c814
commit 35070f6ba2
3 changed files with 7 additions and 8 deletions

View file

@ -124,6 +124,8 @@ CREATE TABLE sessions (
master IS NULL OR "exclusive" IS NULL),
CONSTRAINT exclusive_expired_sane CHECK (
expired IS FALSE OR "exclusive" IS NULL),
CONSTRAINT no_closed_exclusive CHECK (
closed IS FALSE OR "exclusive" IS NULL),
UNIQUE (user_id,exclusive)
) WITHOUT OIDS;
CREATE INDEX sessions_master ON sessions(master);

View file

@ -2745,8 +2745,6 @@ class ClientSession(object):
self.new_session()
# forget our login session, if any
if not self.logged_in:
return
self.setSession(None)
# we've had some trouble with this method causing strange problems
@ -2789,7 +2787,7 @@ class ClientSession(object):
if self.logged_in and not self.sinfo.get('header-auth'):
# old server
handler = "%s?%s" % (self.baseurl, six.moves.urllib.parse.urlencode(sinfo))
elif name in 'sslLogin':
elif name == 'sslLogin':
handler = self.baseurl + '/ssllogin'
else:
handler = self.baseurl
@ -2961,9 +2959,7 @@ class ClientSession(object):
# server correctly reporting an outage
tries = 0
continue
else:
raise err
raise err
except (SystemExit, KeyboardInterrupt):
# (depending on the python version, these may or may not be subclasses of
# Exception)

View file

@ -439,8 +439,9 @@ class Session(object):
excl_id = query.singleValue(strict=False)
if excl_id:
if force:
# expire the previous exclusive session and try again
update = UpdateProcessor('sessions', data={'expired': True, 'exclusive': None},
# close the previous exclusive sessions and try again
update = UpdateProcessor('sessions',
data={'expired': True, 'exclusive': None, 'closed': True},
clauses=['id=%(excl_id)s'], values={'excl_id': excl_id},)
update.execute()
else: