Example #1
0
def db_test():
    try:
        DBHelper.connect()
        DBHelper.create_db_tables()
        return str(Token.select().count())
    finally:
        DBHelper.close()
Example #2
0
def remove(team_id):
    try:
        DBHelper.connect()
        token = Token.get(Token.issuer == team_id)
        delete_count = token.delete_instance()
    finally:
        DBHelper.close()
Example #3
0
def store(team_id, auth_token, app):
    try:
        DBHelper.connect()
        token, created = Token.get_or_create(issuer=team_id,
                                             app=app,
                                             defaults={'token': auth_token})
        token.token = auth_token
        token.save()
    finally:
        DBHelper.close()
Example #4
0
def get(team_id):
    try:
        DBHelper.connect()
        return Token.get(Token.issuer == team_id).token
    finally:
        DBHelper.close()