Opened 2 years ago

Closed 2 years ago

Last modified 17 months ago

#9655 enhancement closed fixed (fixed)

Allow an application to specify the Twisted Web upload directory as a parameter instead of as global state

Reported by: Jean-Paul Calderone Owned by: Jean-Paul Calderone
Priority: normal Milestone:
Component: web Keywords:
Cc: Branch:
Author:

Description

twisted.web.http.Request.gotLength uses tempfile.TemporaryFile to get a file into which to write large upload content. tempfile.TemporaryFile uses the tempfile module which respects tempfile.tempdir for the location of these files. If an application wants Twisted Web to write these files to a particular location, setting tempfile.tempdir is the obvious "solution". But mutating global state is rarely a satisfying or long term solution.

Give Twisted Web some other API for specifying where these files are written.

Change History (8)

comment:1 Changed 2 years ago by Jean-Paul Calderone

Owner: set to Jean-Paul Calderone
Status: newassigned

comment:2 Changed 2 years ago by Jean-Paul Calderone

Keywords: review added

comment:3 Changed 2 years ago by Jean-Paul Calderone

Owner: Jean-Paul Calderone deleted
Status: assignednew

comment:4 Changed 2 years ago by Jean-Paul Calderone

This would help Tahoe-LAFS do a little less crazy global state mutation. https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3052

comment:5 Changed 2 years ago by hawkowl

Keywords: review removed
Owner: set to Jean-Paul Calderone

Only one question: why doesn't the site expose it by default, therefore making it part of the expected API, whilst still making it optional? Is that just because we can't really define "optional" parts of the API well?

Anyway, LGTM, merge away.

comment:6 Changed 2 years ago by Jean-Paul Calderone

Only one question: why doesn't the site expose it by default, therefore making it part of the expected API, whilst still making it optional? Is that just because we can't really define "optional" parts of the API well?

It's been long enough that I don't remember why I decided to do it this way. I think it might have been something to do with HTTPFactory vs Site.

comment:7 Changed 2 years ago by Jean-Paul Calderone <exarkun@…>

Resolution: fixed
Status: newclosed

In e79b08e1:

Merge pull request #1155 from twisted/9655-twisted-web-tempfile-parameter

Parameterized Request content file

Author: exarkun
Reviewer: hawkowl
Fixes: ticket:9655

comment:8 Changed 17 months ago by Jean-Paul Calderone

This was a duplicate of #5281 fwiw.

Note: See TracTickets for help on using tickets.