Commit 13f41449 authored by Pietro Albini's avatar Pietro Albini

Enable caching for most of the download pages

parent 83e39e9f
Pipeline #65 passed with stage
in 0 seconds
...@@ -68,7 +68,7 @@ def after_request(response): ...@@ -68,7 +68,7 @@ def after_request(response):
# Do dome filtering # Do dome filtering
if status != 200 or method != "GET": if status != 200 or method != "GET":
return result return response
if url.endswith("/"): if url.endswith("/"):
url += "index.html" url += "index.html"
......
...@@ -26,6 +26,7 @@ import itsdangerous ...@@ -26,6 +26,7 @@ import itsdangerous
import requests import requests
import pkg_resources import pkg_resources
from . import cache
from . import launchpad from . import launchpad
...@@ -218,6 +219,7 @@ class Downloads: ...@@ -218,6 +219,7 @@ class Downloads:
bp = flask.Blueprint("download", __name__) bp = flask.Blueprint("download", __name__)
@bp.route("/") @bp.route("/")
@cache.enable
def index(): def index():
return flask.render_template( return flask.render_template(
"download/index.html", "download/index.html",
...@@ -225,6 +227,7 @@ class Downloads: ...@@ -225,6 +227,7 @@ class Downloads:
) )
@bp.route("/<distro>") @bp.route("/<distro>")
@cache.enable
def landing(distro): def landing(distro):
if distro not in self.config["distros"]: if distro not in self.config["distros"]:
flask.abort(404) flask.abort(404)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment