Skip to content

Commit

Permalink
Replace trans.sa_session with sa_session in PSANonce.
Browse files Browse the repository at this point in the history
  • Loading branch information
VJalili committed Oct 6, 2018
1 parent 12a3f7b commit 49bb3a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/authnz/psa_authnz.py
Expand Up @@ -238,7 +238,7 @@ def is_integrity_error(cls, exception):
def on_the_fly_config(trans):
trans.app.model.PSACode.sa_session = trans.sa_session
trans.app.model.UserAuthnzToken.trans = trans
trans.app.model.PSANonce.trans = trans
trans.app.model.PSANonce.sa_session = trans.sa_session
trans.app.model.PSAPartial.trans = trans
trans.app.model.PSAAssociation.sa_session = trans.sa_session

Expand Down
15 changes: 7 additions & 8 deletions lib/galaxy/model/__init__.py
Expand Up @@ -4811,27 +4811,26 @@ def get_code(cls, code):

class PSANonce(NonceMixin):

# This static property is of type: galaxy.web.framework.webapp.GalaxyWebTransaction
# and it is set in: galaxy.authnz.psa_authnz.PSAAuthnz
trans = None
# This static property is set at: galaxy.authnz.psa_authnz.PSAAuthnz
sa_session = None

def __init__(self, server_url, timestamp, salt):
self.server_url = server_url
self.timestamp = timestamp
self.salt = salt

def save(self):
self.trans.sa_session.add(self)
self.trans.sa_session.flush()
self.sa_session.add(self)
self.sa_session.flush()

@classmethod
def use(cls, server_url, timestamp, salt):
try:
return cls.trans.sa_session.query(cls).filter_by(server_url=server_url, timestamp=timestamp, salt=salt)[0]
return cls.sa_session.query(cls).filter_by(server_url=server_url, timestamp=timestamp, salt=salt)[0]
except IndexError:
instance = cls(server_url=server_url, timestamp=timestamp, salt=salt)
cls.trans.sa_session.add(instance)
cls.trans.sa_session.flush()
cls.sa_session.add(instance)
cls.sa_session.flush()
return instance


Expand Down

0 comments on commit 49bb3a6

Please sign in to comment.