Skip to content

Commit 129e773

Browse files
committed
Doh! SQLAlchemy <grumble>, <grumble>, ...
1 parent dfb770b commit 129e773

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/pbench/server/database/models/auth_tokens.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
from pbench.server.database.database import Database
77

8-
# Convenient shortened name
9-
dbs = Database.db_session
10-
118

129
class AuthToken(Database.Base):
1310
"""Model for storing the active auth tokens associated with a user."""
@@ -35,6 +32,7 @@ def query(auth_token: str) -> Optional["AuthToken"]:
3532
An AuthToken object if found, otherwise None
3633
"""
3734
# We currently only query token database with the given token.
35+
dbs = Database.db_session
3836
return dbs.query(AuthToken).filter_by(auth_token=auth_token).first()
3937

4038
@staticmethod
@@ -44,6 +42,7 @@ def delete(auth_token: str):
4442
Args:
4543
auth_token : the auth token to delete
4644
"""
45+
dbs = Database.db_session
4746
try:
4847
dbs.query(AuthToken).filter_by(auth_token=auth_token).delete()
4948
dbs.commit()

0 commit comments

Comments
 (0)