Ticket #15672: ticket-15672.diff
File ticket-15672.diff, 2.1 KB (added by , 14 years ago) |
---|
-
django/core/handlers/wsgi.py
265 265 exc_info=sys.exc_info(), 266 266 extra={ 267 267 'status_code': 400, 268 'request': request269 268 } 270 269 ) 271 270 response = http.HttpResponseBadRequest() -
django/core/handlers/modpython.py
179 179 try: 180 180 request = self.request_class(req) 181 181 except UnicodeDecodeError: 182 logger.warning('Bad Request (UnicodeDecodeError) : %s' % request.path,182 logger.warning('Bad Request (UnicodeDecodeError)', 183 183 exc_info=sys.exc_info(), 184 184 extra={ 185 185 'status_code': 400, 186 'request': request187 186 } 188 187 ) 189 188 response = http.HttpResponseBadRequest() -
tests/regressiontests/handlers/tests.py
1 1 from django.utils import unittest 2 2 from django.conf import settings 3 3 from django.core.handlers.wsgi import WSGIHandler 4 from django.test import RequestFactory 4 5 6 5 7 class HandlerTests(unittest.TestCase): 6 8 7 9 def test_lock_safety(self): … … 23 25 # Reset settings 24 26 settings.MIDDLEWARE_CLASSES = old_middleware_classes 25 27 28 def test_bad_path_info(self): 29 """Tests for bug #15672 ('request' referenced before assignment)""" 30 environ = RequestFactory().get('/').environ 31 environ['PATH_INFO'] = '\xed' 32 handler = WSGIHandler() 33 response = handler(environ, lambda *a, **k: None) 34 self.assertEqual(response.status_code, 400)