

def is_resource_modified(environ, etag=None, data=None, last_modified=None):
    'Convenience method for conditional requests.\n\n    :param environ: the WSGI environment of the request to be checked.\n    :param etag: the etag for the response for comparison.\n    :param data: or alternatively the data of the response to automatically\n                 generate an etag using :func:`generate_etag`.\n    :param last_modified: an optional date of the last modification.\n    :return: `True` if the resource was modified, otherwise `False`.\n    '
    if ((etag is None) and (data is not None)):
        etag = generate_etag(data)
    elif (data is not None):
        raise TypeError('both data and etag given')
    if (environ['REQUEST_METHOD'] not in ('GET', 'HEAD')):
        return False
    unmodified = False
    if isinstance(last_modified, string_types):
        last_modified = parse_date(last_modified)
    if (last_modified is not None):
        last_modified = last_modified.replace(microsecond=0)
    modified_since = parse_date(environ.get('HTTP_IF_MODIFIED_SINCE'))
    if (etag and last_modified and (last_modified <= modified_since)):
        unmodified = True
    if etag:
        if_none_match = parse_etags(environ.get('HTTP_IF_NONE_MATCH'))
        if if_none_match:
            unmodified = if_none_match.contains_raw(etag)
    return (not unmodified)

dataset/ETHPy150Open Eforcers/gae-flask-todo/lib/werkzeug/http.py is_resource_modified/VarMisuse@146/369 `modified_since`->`etag`