示例#1
0
def facebook_authorized(resp):
    if resp is None:
        return 'Access denied: reason=%s error=%s' % (
            request.args['error_reason'], request.args['error_description'])

    make_login(oauth_token=resp['access_token'])

    next_url = url_for(
        'minhas_bandas') if session['current_user'].tipo else url_for(
            'cadastro')
    return redirect(next_url)
示例#2
0
def facebook_authorized(resp):
    if resp is None:
        return 'Access denied: reason=%s error=%s' % (
            request.args['error_reason'],
            request.args['error_description']
        )

    make_login(oauth_token=resp['access_token'])

    next_url = url_for('minhas_bandas') if session['current_user'].tipo else url_for('cadastro')
    return redirect(next_url)
示例#3
0
def novo():
    if has_cookie_login(request) and not user_logged():
        make_login(oauth_token=get_cookie_login(request))

    current_user = get_current_user()
    current_city = current_user.city if current_user and current_user.city else "Rio de Janeiro"

    minhas_bandas_shows = []
    if current_user:
        minhas_bandas = get_user_bands(user=current_user)

        if request.args.get('band'):
            minhas_bandas.insert(0, get_band(slug=request.args.get('band')))

        minhas_bandas_shows.extend(
            get_shows_from_bands(minhas_bandas, 1, city=current_city))
    else:
        top_bands = [
            get_band("legiao-urbana"),
            get_band("the-beatles"),
            get_band("linkin-park"),
            get_band("queen"),
            get_band("guns-n-roses")
        ]

        if request.args.get('band'):
            top_bands.insert(0, get_band(slug=request.args.get('band')))

        minhas_bandas_shows = get_shows_from_bands(top_bands,
                                                   1,
                                                   city=current_city,
                                                   force_to_include_band=True)
        los_bife_band = get_band(slug="los-bife")
        minhas_bandas_shows.append((los_bife_band, los_bife_band.shows[:1]))

    return render_template("novo.html",
                           current_user=current_user,
                           minhas_bandas_shows=minhas_bandas_shows,
                           notas=range(11),
                           BANDAS_CAMISAS=BANDAS_CAMISAS,
                           formulario_pag_seguro=formulario_pag_seguro,
                           range_tamanhos=range_tamanhos)
示例#4
0
def novo():
    if has_cookie_login(request) and not user_logged():
        make_login(oauth_token=get_cookie_login(request))

    current_user = get_current_user()
    current_city = current_user.city if current_user and current_user.city else "Rio de Janeiro"

    minhas_bandas_shows = []
    if current_user:
        minhas_bandas = get_user_bands(user=current_user)

        if request.args.get('band'):
            minhas_bandas.insert(0, get_band(slug=request.args.get('band')))

        minhas_bandas_shows.extend(get_shows_from_bands(minhas_bandas, 1, city=current_city))
    else:
        top_bands = [
                        get_band("legiao-urbana"),
                        get_band("the-beatles"),
                        get_band("linkin-park"),
                        get_band("queen"),
                        get_band("guns-n-roses")
        ]

        if request.args.get('band'):
            top_bands.insert(0, get_band(slug=request.args.get('band')))

        minhas_bandas_shows = get_shows_from_bands(top_bands, 1, city=current_city, force_to_include_band=True)
        los_bife_band = get_band(slug="los-bife")
        minhas_bandas_shows.append((los_bife_band, los_bife_band.shows[:1]))



    return render_template("novo.html", current_user=current_user,
        minhas_bandas_shows=minhas_bandas_shows, notas=range(11), BANDAS_CAMISAS=BANDAS_CAMISAS,
        formulario_pag_seguro=formulario_pag_seguro, range_tamanhos=range_tamanhos)