# HG changeset patch # User Ludovic Chabant # Date 1518897042 28800 # Node ID c8518f5cedbbd52369b597e824c47f894cceff4e # Parent ea6cbd6d2af5337ab3640976560b1ae1d7eae0ec serve: Do some more useful debug logging when serving assets. diff -r ea6cbd6d2af5 -r c8518f5cedbb piecrust/serving/util.py --- 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)