On 02:45 pm, [email protected] wrote:
>Hallo,
>
>I'm currently realizing a web server for my company which allows 
>control of
>some of our embedded devices. After some research, I decided on python 
>and
>twisted as the way to go using genshi as templating engine, which works 
>very
>well.
>The problem I encountered is as follows: The user of the web panel 
>should also
>be able to upgrade the firmware on our device. To make this possible, a 
>file
>upload has to take place. The firmware file can have a size of up to 
>150MB, so
>it will not fit in the RAM of our device. It either won't fit on the 
>NAND flash
>chip twice, so it should be written to NAND with its final name and not 
>as a
>temporary file. To tell the server where to store the file upload, I 
>could add a
>hidden input to the upload form indicating the type of the file being 
>uploaded,
>so that the web server can save it to the right location.
>Where's the place to hook in twisted to implement such a behaviour? Do 
>I
>really have to write a completely independent implementation of the 
>HTTP
>handler or could I also reuse some parts of twisted.web?
>Does some code exist already which implements the wanted behaviour or 
>could be
>modified to implement it?

You can override `Request.gotLength` to inspect the request and select 
an appropriate destination for the request body.

You can convince Site to use your custom request by setting it as the 
`requestFactory` attribute.

Jean-Paul

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to