def delete_session(account): """ Delete the session assiociated with that account. """ try: session = AccountSession.get(AccountSession.account == account) session.delete_instance() except AccountSession.DoesNotExist: LOG.warning("Tried to delete an non-existing session.")
def get_session(account_name): """ Return the session associated with the account with that name, or None if no session or account can be found. """ account = AccountManager.get_account(account_name) if account is None: return None try: return AccountSession.get(AccountSession.account == account) except AccountSession.DoesNotExist: return None