Skip to content
Myr

Emit correct date. In theory

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent aa3d839 · Browse files · 2 files+12 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−1 removed

  • tests:+1 added−1 removed
  • other:+11 added−0 removed

2 files+12 added−1 removed

modified:flask/helpers.py+11 added
238 unmodified lines
239 :param add_etags: set to `False` to disable attaching of etags.240 :param conditional: set to `True` to enable conditional responses.241 :param cache_timeout: the timeout in seconds for the headers.242 """243 mtime = None244 if isinstance(filename_or_fp, basestring):245 filename = filename_or_fp246 file = None247 else:
24 unmodified lines
272 data = None273 else:274 if file is None:275 file = open(filename, 'rb')276 mtime = os.path.getmtime(filename)277 data = wrap_file(request.environ, file)278279 rv = current_app.response_class(data, mimetype=mimetype, headers=headers,280 direct_passthrough=True)281282 # if we know the file modification date, we can store it as the283 # current time to better support conditional requests. Werkzeug284 # as of 0.6.1 will override this value however in the conditional285 # response with the current time. This will be fixed in Werkzeug286 # with a new release, however many WSGI servers will still emit287 # a separate date header.288 if mtime is not None:289 rv.date = int(mtime)290291 rv.cache_control.public = True292 if cache_timeout:293 rv.cache_control.max_age = cache_timeout294 rv.expires = int(time() + cache_timeout)
119 unmodified lines
modified:tests/flask_tests.py+1 added-1 removed
17 unmodified lines
18import tempfile19from logging import StreamHandler20from contextlib import contextmanager21from datetime import datetime22from werkzeug import parse_date, parse_options_header22from werkzeug import parse_date, parse_options_header, http_date23from werkzeug.exceptions import NotFound24from jinja2 import TemplateNotFound25from cStringIO import StringIO26
991 unmodified lines