Mercurial > piecrust2
changeset 1095:c8518f5cedbb
serve: Do some more useful debug logging when serving assets.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 17 Feb 2018 11:50:42 -0800 |
parents | ea6cbd6d2af5 |
children | 2aa6174453c8 |
files | piecrust/serving/util.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/serving/util.py Sat Feb 17 11:50:17 2018 -0800 +++ b/piecrust/serving/util.py Sat Feb 17 11:50:42 2018 -0800 @@ -107,17 +107,17 @@ def make_wrapped_file_response(environ, request, path): - logger.debug("Serving %s" % path) - # Check if we can return a 304 status code. mtime = os.path.getmtime(path) etag_str = '%s$$%s' % (path, mtime) etag = hashlib.md5(etag_str.encode('utf8')).hexdigest() if etag in request.if_none_match: + logger.debug("Serving %s [no download, E-Tag matches]" % path) response = Response() response.status_code = 304 return response + logger.debug("Serving %s [full download]" % path) wrapper = wrap_file(environ, open(path, 'rb')) response = Response(wrapper) _, ext = os.path.splitext(path)