Opened 18 years ago
Closed 17 years ago
#2976 closed defect (fixed)
[patch] repr(uploadfile) should not contain the file content
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | major | Keywords: | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If uploadfilecontent is very long, repr(uploadfile) produce non-readable stuff.
It sometimes make a browser hang.
A significant performance problem occur on following scenario.
- You have a model that has many nullable/blankable fields with a FileField.
- You upload big file, without filling nullable fields.
- In view, manipulator.save is called.
- for each field, validation is called.
- for nullable field, while getting field from new_data, repr(new_data) is called, which trigger repr(upload_file)
- repr(upload_file) is very long. It is called for each nullable field. this take long time. (taked 4s~12s for my app)
Sorry for my poor explanation.
Attachments (1)
Change History (5)
by , 18 years ago
Attachment: | fileupload-repr.patch added |
---|
comment:1 by , 18 years ago
I think it would be helpful to at least display some content of the file, eg. the first 40-60 characters.
Something like this would work:
clen = len(filedict["content"]) if clen > 40: suffix = "... and %d more" % (clen - 40) copy["content"] = filedict["content"][:40] + suffix
comment:2 by , 18 years ago
Summary: | [PATCH] repr(uploadfile) should not contain the file content. → [patch] repr(uploadfile) should not contain the file content |
---|
comment:3 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
Note:
See TracTickets
for help on using tickets.
suppress uploadfilecontent's display.