mirror of
https://github.com/FAUSheppy/python-flask-picture-factory
synced 2025-12-05 22:51:36 +01:00
allow definition of a cache timeout in url args
This commit is contained in:
@@ -95,7 +95,16 @@ def sendPicture(path):
|
||||
|
||||
raw = flask.send_from_directory(".", path, cache_timeout=cache_timeout)
|
||||
response = flask.make_response(raw)
|
||||
|
||||
response.headers['X-ATHQ-INTERNAL-FID'] = path
|
||||
|
||||
# check for a cacheTimeout #
|
||||
cacheTimeout = request.args.get("cache-timeout")
|
||||
if not cacheTimeout:
|
||||
cacheTimeout = request.args.get("ct")
|
||||
if cacheTimeout:
|
||||
response.headers['Cache-Control'] = "max-age=" + str(cacheTimeout)
|
||||
|
||||
return response
|
||||
|
||||
@app.route("/")
|
||||
|
||||
Reference in New Issue
Block a user