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)
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)
def user_logged_test(self): with self.app.test_request_context(): self.assertFalse(user_logged()) flask.session["current_user"] = self.guilherme_user self.assertTrue(user_logged())
def user_logged_test(self): with self.app.test_request_context(): self.assertFalse(user_logged()) flask.session['current_user'] = self.guilherme_user self.assertTrue(user_logged())