diff options
| author | Tom Christie | 2013-05-07 13:27:27 +0100 | 
|---|---|---|
| committer | Tom Christie | 2013-05-07 13:27:27 +0100 | 
| commit | 3353889ae85cc21890469cf00f7073d1ea5c2070 (patch) | |
| tree | d9e84b7724b34ecc57a82f4d53fdb6c52b5613f8 /rest_framework/parsers.py | |
| parent | 642970a1b8e6ebadbbfc9da4d75fad1ec5da6747 (diff) | |
| download | django-rest-framework-3353889ae85cc21890469cf00f7073d1ea5c2070.tar.bz2 | |
Docs for FileUploadParser
Diffstat (limited to 'rest_framework/parsers.py')
| -rw-r--r-- | rest_framework/parsers.py | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py index 27a0db65..614531a1 100644 --- a/rest_framework/parsers.py +++ b/rest_framework/parsers.py @@ -246,7 +246,7 @@ class FileUploadParser(BaseParser):                  return DataAndFiles(None, {'file': result[1]})          possible_sizes = [x.chunk_size for x in upload_handlers if x.chunk_size] -        chunk_size = min([2**31-4] + possible_sizes) +        chunk_size = min([2 ** 31 - 4] + possible_sizes)          chunks = ChunkIter(stream, chunk_size)          counters = [0] * len(upload_handlers) @@ -280,9 +280,10 @@ class FileUploadParser(BaseParser):              return parser_context['kwargs']['filename']          except KeyError:              pass +          try:              meta = parser_context['request'].META              disposition = parse_header(meta['HTTP_CONTENT_DISPOSITION'])              return disposition[1]['filename']          except (AttributeError, KeyError): -            pass +            raise ParseError("Filename must be set in Content-Disposition header.") | 
