Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 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@…> 6 years ago.
patch - attrib check on content
storage_save_str_fix2.diff (832 bytes) - added by Deepak <deep.thukral@…> 6 years ago.
Correct version

Download all attachments as: .zip

Change History (4)

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

patch - attrib check on content

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

Correct version

comment:1 follow-up: Changed 6 years ago by bthomas

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 6 years ago by bthomas

Oops, bad formatting. I meant

request.FILES['filedata']

of course.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.