Skip to content

Commit

Permalink
Merge branch 'release_23.2' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Feb 22, 2024
2 parents 49e0d43 + 036e469 commit 7b57bf4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9647,11 +9647,12 @@ def save(self):

@classmethod
def store(cls, server_url, association):
try:
def get_or_create():
stmt = select(PSAAssociation).filter_by(server_url=server_url, handle=association.handle).limit(1)
assoc = cls.sa_session.scalars(stmt).first()
except IndexError:
assoc = cls(server_url=server_url, handle=association.handle)
return assoc or cls(server_url=server_url, handle=association.handle)

assoc = get_or_create()
assoc.secret = base64.encodebytes(association.secret).decode()
assoc.issued = association.issued
assoc.lifetime = association.lifetime
Expand All @@ -9663,7 +9664,7 @@ def store(cls, server_url, association):
@classmethod
def get(cls, *args, **kwargs):
stmt = select(PSAAssociation).filter_by(*args, **kwargs)
return cls.sa_session.scalars(stmt)
return cls.sa_session.scalars(stmt).all()

@classmethod
def remove(cls, ids_to_delete):
Expand Down

0 comments on commit 7b57bf4

Please sign in to comment.