Re: [Django] #20948: Form ImageField, MemoryFileUploadHandler and reading content of the InMemoryUploadedFile

2013-10-22 Thread Django
#20948: Form ImageField, MemoryFileUploadHandler and reading content of the
InMemoryUploadedFile
-+--
 Reporter:  p_hrechyshkin@…  |Owner:
 Type:  Uncategorized|   Status:  closed
Component:  Python 2 |  Version:  1.4
 Severity:  Normal   |   Resolution:  invalid
 Keywords:  file upload  | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by timo):

 * status:  new => closed
 * resolution:   => invalid


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/085.3754332c0f5ba72cca9ad6d0a488db51%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20948: Form ImageField, MemoryFileUploadHandler and reading content of the InMemoryUploadedFile

2013-09-06 Thread Django
#20948: Form ImageField, MemoryFileUploadHandler and reading content of the
InMemoryUploadedFile
-+--
 Reporter:  p_hrechyshkin@…  |Owner:
 Type:  Uncategorized|   Status:  new
Component:  Python 2 |  Version:  1.4
 Severity:  Normal   |   Resolution:
 Keywords:  file upload  | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by sduveen):

 * status:  assigned => new
 * owner:  sduveen =>


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/085.554e9b235768c28bfbfe84597afe2ff0%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20948: Form ImageField, MemoryFileUploadHandler and reading content of the InMemoryUploadedFile

2013-09-06 Thread Django
#20948: Form ImageField, MemoryFileUploadHandler and reading content of the
InMemoryUploadedFile
-+--
 Reporter:  p_hrechyshkin@…  |Owner:  sduveen
 Type:  Uncategorized|   Status:  assigned
Component:  Python 2 |  Version:  1.4
 Severity:  Normal   |   Resolution:
 Keywords:  file upload  | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by sduveen):

 * owner:  nobody => sduveen
 * status:  new => assigned


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/085.f6e39d2f1c53e47a58b320ef2fa78336%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20948: Form ImageField, MemoryFileUploadHandler and reading content of the InMemoryUploadedFile

2013-08-21 Thread Django
#20948: Form ImageField, MemoryFileUploadHandler and reading content of the
InMemoryUploadedFile
-+--
 Reporter:  p_hrechyshkin@…  |Owner:  nobody
 Type:  Uncategorized|   Status:  new
Component:  Python 2 |  Version:  1.4
 Severity:  Normal   |   Resolution:
 Keywords:  file upload  | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by apollo13):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 You are supposed to call `image.seek(0)` yourself after you read from it.
 That said, it would be intresting to know why it works for
 `TemporaryUploadedFile`

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/085.e723f25ba15c0b6d539eac02bd77b501%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Django] #20948: Form ImageField, MemoryFileUploadHandler and reading content of the InMemoryUploadedFile

2013-08-21 Thread Django
#20948: Form ImageField, MemoryFileUploadHandler and reading content of the
InMemoryUploadedFile
-+-
 Reporter:  p_hrechyshkin@…  |  Owner:  nobody
 Type:  Uncategorized| Status:  new
Component:  Python 2 |Version:  1.4
 Severity:  Normal   |   Keywords:  file upload
 Triage Stage:  Unreviewed   |  Has patch:  0
Easy pickings:  0|  UI/UX:  0
-+-
 There is a form with ImageField, which returns validation error

 "Upload a valid image. The file you uploaded was either not an image
 or a corrupted image."

 In my view I am trying to read image file content:

 image = self.request.FILES.get('image')
 if image:
 content = "".join(image.chunks())
 Validation error doesn't occur if I comment line with image.chunks(), also
 it isn't showed if I remove
 "django.core.files.uploadhandler.MemoryFileUploadHandler" from
 FILE_UPLOAD_HANDLERS setting.

 So the reason could be in file object created by MemoryFileUploadHandler
 (InMemoryUploadedFile).

 My guess was it could be that after read there is no call file.seek(0)
 which set file reader pointer to the begging of the file.

 It could be ImageFile.to_python assumes that pointer set to the beginning.
 In ImageField.to_python I have added

 data.file.seek(0)
 before

 file = StringIO(data.read())
 and I haven't got image validation error after that.

 Is it proper behavior? Or ImageField shouldn't assume that file haven't
 been read? Or InMemoryUploadedFile should call file.seek(0) after chunks
 iterator ended its work?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.4d160765d43f1bc1e8bdca36b1900a13%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.