Ticket #14020: 14020_with_tests.patch

File 14020_with_tests.patch, 1.2 KB (added by moopet, 13 years ago)
  • django/http/__init__.py

     
    570570    def items(self):
    571571        return self._headers.values()
    572572
    573     def get(self, header, alternate):
     573    def get(self, header, alternate=None):
    574574        return self._headers.get(header.lower(), (None, alternate))[1]
    575575
    576576    def set_cookie(self, key, value='', max_age=None, expires=None, path='/',
  • tests/regressiontests/httpwrappers/tests.py

     
    243243        self.assertRaises(BadHeaderError, r.__setitem__, 'test\rstr', 'test')
    244244        self.assertRaises(BadHeaderError, r.__setitem__, 'test\nstr', 'test')
    245245
     246    def test_dict_behavior(self):
     247        """
     248        Test for bug #14020: Make HttpResponse.get work like dict.get
     249        """
     250        r = HttpResponse()
     251        self.assertEqual(r.get('test'), None)
     252
    246253class CookieTests(unittest.TestCase):
    247254    def test_encode(self):
    248255        """
Back to Top