Ticket #8765: 8765.diff
File 8765.diff, 1.6 KB (added by , 16 years ago) |
---|
-
django/http/__init__.py
289 289 290 290 # _headers is a mapping of the lower-case name to the original case of 291 291 # the header (required for working with legacy systems) and the header 292 # value. 293 self._headers = {'content-type': ('Content-Type', content_type)} 292 # value. Both the name of the header and its value are ascii strings. 293 self._headers = {} 294 self.__setitem__('Content-Type', content_type) 294 295 295 296 def __str__(self): 296 297 """Full HTTP message, including headers.""" -
tests/regressiontests/httpwrappers/tests.py
437 437 UnicodeEncodeError: ..., HTTP response headers must be in US-ASCII format 438 438 439 439 # 440 # Regression test for #8765: Content-Types passed to HttpResponse() are also 441 # converted to ascii strings and an exception is raised when a non-ascii 442 # value is used. 443 # 444 >>> r = HttpResponse(content_type=u'text/plain') 445 >>> isinstance(r['Content-Type'], str) 446 True 447 >>> r = HttpResponse(content_type=u'text/pl\xc3\xa6in') # doctest:+ELLIPSIS 448 Traceback (most recent call last): 449 ... 450 UnicodeEncodeError: ..., HTTP response headers must be in US-ASCII format 451 452 # 440 453 # Regression test for #8278: QueryDict.update(QueryDict) 441 454 # 442 455 >>> x = QueryDict("a=1&a=2", mutable=True)