def create_or_login(resp):
    match = _steam_id_re.search(resp.identity_url)
    g.user = User.get_or_create(match.group(1))
    steamdata = get_steam_userinfo(g.user.steamid)
    g.user.nickname = steamdata['personaname']
    db.session.commit()
    session['user_id'] = g.user.id
    return redirect(oid.get_next_url())
def create_or_login(resp):
    match = _steam_id_re.search(resp.identity_url)
    g.user = User.get_or_create(match.group(1))
    steamdata = get_steam_userinfo(g.user.steamid)
    g.user.nickname = steamdata['personaname']
    db.session.commit()
    session['user_id'] = g.user.id
    return redirect(oid.get_next_url())
def logout():
    session.pop('user_id', None)
    return redirect(oid.get_next_url())
def login():
    if getattr(g, 'user', None) is not None:
        return redirect(oid.get_next_url())
    return oid.try_login('http://steamcommunity.com/openid')
def logout():
    session.pop('user_id', None)
    return redirect(oid.get_next_url())
def login():
    if getattr(g, 'user', None) is not None:
        return redirect(oid.get_next_url())
    return oid.try_login('http://steamcommunity.com/openid')