Beispiel #1
0
def db_test():
    try:
        DBHelper.connect()
        DBHelper.create_db_tables()
        return str(Token.select().count())
    finally:
        DBHelper.close()
def remove(team_id):
    try:
        DBHelper.connect()
        token = Token.get(Token.issuer == team_id)
        delete_count = token.delete_instance()
    finally:
        DBHelper.close()
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()
def get(team_id):
    try:
        DBHelper.connect()
        return Token.get(Token.issuer == team_id).token
    finally:
        DBHelper.close()