Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#9184 closed (invalid)

'str' object has no attribute 'chunks'

Reported by: Deepak <deep.thukral@…> Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Uploading file to FileField causes AttributeError. I used

my_object.my_field.save(somename, content, save=False) 

Here content is a string from

request.FILES['filedata'].read()

Attachments (2)

storage_save_str_fix.diff (743 bytes) - added by Deepak <deep.thukral@…> 8 years ago.
patch - attrib check on content
storage_save_str_fix2.diff (832 bytes) - added by Deepak <deep.thukral@…> 8 years ago.
Correct version

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by Deepak <deep.thukral@…>

Attachment: storage_save_str_fix.diff added

patch - attrib check on content

Changed 8 years ago by Deepak <deep.thukral@…>

Attachment: storage_save_str_fix2.diff added

Correct version

comment:1 Changed 8 years ago by Bob Thomas

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: invalid
Status: newclosed

According to the documentation: http://docs.djangoproject.com/en/dev/ref/files/file/#django.core.files.File.save

The content argument is supposed to be a subclass of File, such as UploadFile. Just use request.FILESfiledata? for content instead of request.FILESfiledata?.read()

comment:2 in reply to:  1 Changed 8 years ago by Bob Thomas

Oops, bad formatting. I meant

request.FILES['filedata']

of course.

Note: See TracTickets for help on using tickets.
Back to Top