Ticket #18675: 0001-18675.patch

File 0001-18675.patch, 2.1 KB (added by Simon Charette, 12 years ago)
  • django/views/static.py

    From ca9b5695f07ca50790ce7398e77b04e4c97f168c Mon Sep 17 00:00:00 2001
    From: Simon Charette <charette.s@gmail.com>
    Date: Fri, 27 Jul 2012 15:28:09 -0400
    Subject: [PATCH] Fixed #18675 -- Make sure if-modified-since works on 64
     oses.
    
    ---
     django/views/static.py                             |    2 +-
     .../conditional_processing/models.py               |   11 ++++++++++-
     2 files changed, 11 insertions(+), 2 deletions(-)
    
    diff --git a/django/views/static.py b/django/views/static.py
    index bcac947..bb1dcfd 100644
    a b def was_modified_since(header=None, mtime=0, size=0):  
    138138        header_len = matches.group(3)
    139139        if header_len and int(header_len) != size:
    140140            raise ValueError
    141         if mtime > header_mtime:
     141        if int(mtime) > header_mtime:
    142142            raise ValueError
    143143    except (AttributeError, ValueError, OverflowError):
    144144        return True
  • tests/regressiontests/conditional_processing/models.py

    diff --git a/tests/regressiontests/conditional_processing/models.py b/tests/regressiontests/conditional_processing/models.py
    index d1a8ac6..5487276 100644
    a b from datetime import datetime  
    33
    44from django.test import TestCase
    55from django.utils import unittest
    6 from django.utils.http import parse_etags, quote_etag, parse_http_date
     6from django.utils.http import http_date, parse_etags, parse_http_date, quote_etag
     7from django.views.static import was_modified_since
    78
    89
    910FULL_RESPONSE = 'Test conditional get response'
    class HttpDateProcessing(unittest.TestCase):  
    154155        parsed = parse_http_date('Sun Nov  6 08:49:37 1994')
    155156        self.assertEqual(datetime.utcfromtimestamp(parsed),
    156157                         datetime(1994, 11, 6, 8, 49, 37))
     158
     159
     160class WasModifiedSince(unittest.TestCase):
     161    def test_floating_point_mtime(self):
     162        # See #18675
     163        mtime = 1343416141.107817
     164        header = http_date(mtime)
     165        self.assertFalse(was_modified_since(header, mtime))
Back to Top