Opened 6 years ago
Closed 6 years ago
#30567 closed Cleanup/optimization (fixed)
Start passing FileResponse.block_size to wsgi.file_wrapper.
| Reported by: | Chris Jerdonek | Owned by: | Piotr Domański | 
|---|---|---|---|
| Component: | HTTP handling | Version: | dev | 
| Severity: | Normal | Keywords: | block_size, wsgi.file_wrapper, FileResponse, wsgi | 
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description (last modified by )
I noticed that Django's FileResponse class has a block_size attribute which can be customized by subclassing: https://github.com/django/django/blob/415e899dc46c2f8d667ff11d3e54eff759eaded4/django/http/response.py#L393
but it's not passed to wsgi.file_wrapper. Only the filelike object is passed:
response = environ['wsgi.file_wrapper'](response.file_to_stream)
Change History (6)
comment:1 by , 6 years ago
| Description: | modified (diff) | 
|---|
comment:2 by , 6 years ago
| Summary: | Start passing FileResponse.block_size to wsgi.file_wrapper → Start passing FileResponse.block_size to wsgi.file_wrapper. | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
comment:3 by , 6 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
comment:4 by , 6 years ago
| Has patch: | set | 
|---|---|
| Triage Stage: | Accepted → Ready for checkin | 
Pull request: https://github.com/django/django/pull/11592
comment:5 by , 6 years ago
| Triage Stage: | Ready for checkin → Accepted | 
|---|
  Note:
 See   TracTickets
 for help on using tickets.
    
Seems reasonable, Thanks (see example-of-wrapper-usage).