Changes between Initial Version and Version 1 of Ticket #17474


Ignore:
Timestamp:
12/29/2011 04:57:04 AM (4 years ago)
Author:
aaugustin
Comment:

Improved formatting (please use preview).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17474

    • Property Needs documentation unset
    • Property Needs tests unset
    • Property Patch needs improvement unset
  • Ticket #17474 – Description

    initial v1  
    11I don't know exactly why, but some ajax requests don't have Content-Type header.
    2 When this happens, when I try to get request.POST, I got the following exception: 'NoneType' object has no attribute 'startswith',
    3 raised by method _load_post_and_files (line 270) of django/http/__init__.py.
     2When this happens, when I try to get `request.POST`, I got the following exception: `'NoneType' object has no attribute 'startswith'`,
     3raised by method `_load_post_and_files` at line 270 of `django/http/__init__.py`.
    44
    5 The problem is that when the request doesn't have Content-Type, self.META.get('CONTENT_TYPE', '') returns None.
     5The problem is that when the request doesn't have Content-Type, `self.META.get('CONTENT_TYPE', '')` returns `None`.
    66To fix the problem I just did it:
    7 <code>
     7{{{
    88content_type = self.META.get('CONTENT_TYPE', None) or ''
    99if content_type.startswith('multipart'):
    10 </code>
     10}}}
Back to Top