app/django/middleware/http.py
changeset 323 ff1a9aa48cfd
parent 54 03e267d67478
equal deleted inserted replaced
322:6641e941ef1e 323:ff1a9aa48cfd
    17             if_none_match = request.META.get('HTTP_IF_NONE_MATCH', None)
    17             if_none_match = request.META.get('HTTP_IF_NONE_MATCH', None)
    18             if if_none_match == response['ETag']:
    18             if if_none_match == response['ETag']:
    19                 # Setting the status is enough here. The response handling path
    19                 # Setting the status is enough here. The response handling path
    20                 # automatically removes content for this status code (in
    20                 # automatically removes content for this status code (in
    21                 # http.conditional_content_removal()).
    21                 # http.conditional_content_removal()).
    22                 response.status = 304
    22                 response.status_code = 304
    23 
    23 
    24         if response.has_header('Last-Modified'):
    24         if response.has_header('Last-Modified'):
    25             if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE', None)
    25             if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE', None)
    26             if if_modified_since == response['Last-Modified']:
    26             if if_modified_since == response['Last-Modified']:
    27                 # Setting the status code is enough here (same reasons as
    27                 # Setting the status code is enough here (same reasons as
    28                 # above).
    28                 # above).
    29                 response.status = 304
    29                 response.status_code = 304
    30 
    30 
    31         return response
    31         return response
    32 
    32 
    33 class SetRemoteAddrFromForwardedFor(object):
    33 class SetRemoteAddrFromForwardedFor(object):
    34     """
    34     """