Ticket #10581: 10581.diff

File 10581.diff, 1.5 KB (added by Ivan Sagalaev, 15 years ago)

Patch

  • django/views/decorators/http.py

    === modified file 'django/views/decorators/http.py'
     
    7575            if if_none_match or if_match:
    7676                # There can be more than one ETag in the request, so we
    7777                # consider the list of values.
    78                 etags = parse_etags(if_none_match)
     78                etags = parse_etags(if_none_match or if_match)
    7979
    8080            # Compute values (if any) for the requested resource.
    8181            if etag_func:
  • tests/regressiontests/conditional_processing/models.py

    === modified file 'tests/regressiontests/conditional_processing/models.py'
     
    5050        response = self.client.get('/condition/')
    5151        self.assertNotModified(response)
    5252
     53    def testIfMatch(self):
     54        self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % ETAG
     55        response = self.client.put('/condition/etag/', {'data': ''})
     56        self.assertEquals(response.status_code, 200)
     57        self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % EXPIRED_ETAG
     58        response = self.client.put('/condition/etag/', {'data': ''})
     59        self.assertEquals(response.status_code, 412)
     60
    5361    def testBothHeaders(self):
    5462        self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
    5563        self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
Back to Top