[Twisted-web] Large file uploads

Julian Pietron julian at whisper-net.de
Fri Jul 23 16:34:21 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 16.07.2010 17:33, schrieb exarkun at twistedmatrix.com:
> 
> 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
> 

Hi,

thanks for your reply. In meantime I tried cherrypy, which does its job
very good but has some flaws compared to my twisted applications when it
comes to performance and resource usage. So I'm still interested in
solving my problem by using twisted.
The problem is as follows: The file which shall be uploaded is sent via
a HTML form (encoded as multipart/form-data), and I'd like to use
Python's FieldStorage to parse the request body because it handles the
file matters very well. You can tell cherrypy, that for a certain
request uri cherrypy should not parse the request body but instead pass
it on unparsed to the handler method.
Is there a simple way of configuring twisted.web in this way to?
So that e.g. if request uri /do-upload-form is issued, twisted.web does
not try to parse the request body on its own and generate the args dict
to pass on to the render_POST method, but instead uses FieldStorage (or
better: my own subclass of FieldStorage, which employs a NamedTempFile
instead of an anonymous tempfile, which allows me to simply rename it
after it has passed some sanity checks) for parsing the body?

Thanks for your reply,
Julian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMSfzNAAoJENidYKvYQHlQNvwQAMdZLl6S2hXgGyMDYEezILEB
xSQgaZ0ZcvWbuoAt4wwwYwzWHT778VaYfsnn5IJnpumluylu2KiMj1TDJpumOo7I
WvSVpBVojrr1akXx8QLNOYCtFVLteRWOahKYG6P2OQlf5moJm/E4PfAKwVn4Ogba
TgJ3joujIYyZy/WX5n+TBHWweT1dthr7a1nDsJJzMhTuqW7X3O9lw+ewC83n320L
3V4rO0rgBF84ltCjiiOK10lR5F2VjjkS975Y1N6CEYhtl0NORbWmKIummb5bpnjT
uSqvwCb0WOXhzvPPHs+MDXDCxkW83TmFOHtCsFnWtS9FXmTUuMi1eNZX8PyshT9D
2t8lvdFFZFwvsgR0BATt+jI3nJzcz06Xo1OrYUr2G91UI8ITsFRcP4EdawKFAfap
CInUvB7bZMDe19j+cRlGGRBEiLFaLMG6KUoaCFkHWVleMmgKPuEtq4Iz9QTNRNq1
HMZDFhmYIJGa8sSbijI6+UqrCqY70VcMQNScm0D3nUlLlXEoYM+myY2VC89NLWfx
8IN44CzLBI2KO9J8B2m/dk8rMRUvYRKP+Wll3OyOEdQvCh7pJh3auIn8nY3P14Az
5E3LvXxOJP4NCHIW8rImy/3Fpfl4dOANF7QuXdeXBp8XOnkG5qX69cqX6T2Cemtq
9qCEF/ddp3yoiNr4Kwng
=EPhL
-----END PGP SIGNATURE-----



More information about the Twisted-web mailing list