[Twisted-web] Re: [Twisted-Python] When can I start using web2?

David Reid dreid at dreid.org
Sun Oct 9 14:34:34 MDT 2005


[Oops, stupid search folders, I didn't notice I wasn't sending it to
twisted-web]

On Wed, 2005-10-05 at 12:48 -0400, James Y Knight wrote:

> > * File uploads.
> 
> Should work, needs documentationing. Summary: fileupload.py is the  
> low level functionality that you usually don't need to call
directly.  
> server.parsePOSTData is the "normal" interface into this system,  
> which is what resource.PostableResource calls when confronted with a  
> POST. It does what you want most of the time: incrementally parsing  
> the form fields into request.args and request.files, putting the  
> files in temp files on disk, with some limits on the file size  
> (customization of said limits should be pushed out to the toplevel  
> functions but hasn't been). request.args is a dict of {fieldname:  
> valuestring}, request.files is a dict of {fieldname: (filename,  
> content-type, TemporaryFile-instance)}.
> 

Also twisted.web2.static.FileSaver started off as just an example of
handling file uploads and turned into an attempt at a drop in resource
for handling them.  I tried to write it around what I percieved to be a
common use case, which was:
 
 * type limiting
 * size limiting
 * forcing permissions
 * globally unique filenames (FileSaver.makeUniqueName is easily
overrideable if the md5 of filename + the md5 of the time string isn't
sufficient or is overkill for your needs)

I'm not sure if it actually succeeded as more than an example, I don't
know that anyone is actively using it, and I'm rather surprised that
James failed to mention it, perhaps he forgot about it himself.

-David





More information about the Twisted-web mailing list