Ejemplo n.º 1
0
def not_found(error):
    segments = ["404"]
    images = assets_in_paths(app, segments)
    filename = choice(images)
    image = os.path.join("404", filename)
    # 404s should still send the 404 status to the application.
    return render_template("404.html", image=image), 404, {}
Ejemplo n.º 2
0
def universe_context(app, u):
    segments = [u.slug, "images", "banners"]
    banners = assets_in_paths(app, segments)

    if banners:
        segments.append(choice(banners))
        banner = "/".join(segments)
    else:
        banner = None

    return {
        "u": u,
        "banner": banner,
    }
Ejemplo n.º 3
0
def not_found(error):
    segments = ["404"]
    images = assets_in_paths(app, segments)
    filename = choice(images)
    image = os.path.join("404", filename)
    return render_template("404.html", image=image)