Does your project set that setting to a string by mistake? In the default 
settings:

>>> from django.conf import settings
>>> settings.FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
>>> type(settings.FILE_UPLOAD_MAX_MEMORY_SIZE)
<class 'int'>

On Tuesday, April 7, 2015 at 2:11:08 PM UTC-4, Jason Wilson wrote:
>
> Line 167 in django/core/files/uploadhandler.py 
> printing the type of the object settings.FILE_UPLOAD_MAX_MEMORY_SIZE shows 
> this object is read as a string at this point in the code.
> Therefore, the comparison always returns False and self.activated is True
> '
>
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> class MemoryFileUploadHandler(FileUploadHandler):
>     """
>     File upload handler to stream uploads into memory (used for small 
> files).
>     """
>
>     def handle_raw_input(self, input_data, META, content_length, boundary, 
> encoding=None):
>         """
>         Use the content_length to signal whether or not this handler 
> should be in use.
>         """
>         # Check the content-length header to see if we should
>         # If the post is too large, we cannot use the Memory handler.
>         if content_length > settings.FILE_UPLOAD_MAX_MEMORY_SIZE:         
>                ## THIS LINE COMPARES INT WITH STR
>             self.activated = False
>         else:
>             self.activated = True
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2227ba8d-7949-4dab-aa94-41034277675f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to