[twill] FW: Is formfile closing uploaded file ?

Tim Hatch tim at timhatch.com
Fri Apr 4 14:47:31 PDT 2008


On Apr 4, 2008, at 4:26 PM, Titus Brown wrote:

> indeed, it is not being closed.  You can fix commands.py yourself  
> (with
> an fp.close())

We noticed this as well, while testing Trac.  The filehandle can't  
just be closed inside formfile since it needs to still be alive when  
the request is actually sent, and a file pointer isn't accepted as an  
arg to formfile (only filename).  Our monkeypatched version accepts  
either a filename (which is read into a StringIO) or a file pointer  
to be passed through directly (which can be later closed).

http://trac.edgewall.org/browser/sandbox/testing/trac/tests/ 
functional/better_twill.py?rev=6757#L54

Tim



More information about the twill mailing list