I've had a bit of an issue with InMemoryUploadedFile instances that come in
request.FILES to a view. I passed one of them to another constructor to
initialise it, and then I tried to access the `encoding` attribute (which
appears in the help() for the class). I followed the class hierarchy and
found that it leads to FileProxyMixin, where the `encoding` attribute is
defined. This is where my mind is blown though:
def __init__(self, f, *args, **kwargs):
> print type(f) # => 'django.core.files.uploadedfile.InMemoryUploadedFile'>
> print type(f.encoding) # => AttributeError: 'cStringIO.StringO' object
> has no attribute 'encoding'
>
>
How can it in the first line claim that it is an InMemoryUploadedFile, but
in the second line, where I try to access an attribute on it, claim to be a
StringO? To test that this issue is not the result of the instance being
passed too far into my code (where my code messes something up), I tried
the same test in the view directly with the request.FILES['file'] instance,
and the same issue occurs. I should be able to continue without this
attribute, but now I'm just curious. If anyone knows what's going on,
please let me know. Thanks.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/zvo4GJWsYigJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.