[Twisted-Python] Serving files, again

Clark C. Evans cce at clarkevans.com
Wed Feb 26 14:51:35 EST 2003


On Wed, Feb 26, 2003 at 07:20:02PM +0000, Clark C. Evans wrote:
| On Wed, Feb 26, 2003 at 12:48:31AM +0100, Mario Ruggier wrote:
| | Would anyone be able to clarify what the render() method should be
| | such that the url  http://host/docs/some/file.txt will return the file
| | at system location of: /Path/To/Somewhere/some/file.txt ?
| 
| I don't know if this is your question; but I'd return the contents
| of file.txt when the file size is less than a pre-defined size, say 32K.
| Beyond that, the file should be DEFERRED into a thread which sends
| the file a chunk at a time.   Further, it'd be cool if I could 
| specify in the request object if the response should be compressed
| via gzip.

Actually, shouldn't it always be deferred?  The file system may
be writing at the time (via another thread) so doing a file read
(even for a tiny file) at this point could cause significant lag 
or am I completely mis-understanding this whole async-stuff?

Clark




More information about the Twisted-Python mailing list