Commit f1b74f6a authored by Pietro Albini's avatar Pietro Albini

Fixed errors in cache.py and removed unused parts

parent 1f3db333
......@@ -29,7 +29,7 @@ def enable(func):
def remove(path, recursive=False):
"""Remove a path from the cache"""
app = flask.current_app
path = os.path.join(app.cache_path, path)
path = os.path.join(app.config["CACHE_PATH"], path)
try:
if os.path.isdir(path):
......@@ -66,11 +66,11 @@ def after_request(response):
if status != 200 or method != "GET":
return result
# Normalize the page url
if url.endswith("/"):
url += "index.html"
else:
elif "." not in url:
url += ".html"
if url.startswith("/"):
url = url[1:] # Remove / at the start
......@@ -82,13 +82,6 @@ def after_request(response):
return response
def before_request():
"""Hook meant to be executed before a request"""
# TODO: implement the cache
pass
def install_cache(app):
"""Install the cache on a specific app"""
app.before_request(before_request)
app.after_request(after_request)
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