[Web-SIG] Proposal: Handling POST forms in WSGI

Hans Then h.then at pythea.nl
Tue Oct 24 14:25:29 CEST 2006


Phillip,

> -1 on this being middleware.  If middleware wants to read the input,
> it should copy it to a temporary file or StringIO, not remove it.

> The simple, standard way to do something like this would be to have a
> library routine like 'get_form_vars(environ)'.  The routine would
> check for the form vars key, and if not present, then it would
> process the input and cache the information in the environment.  It
> could even have an option to clone the input, in case the routine is
> being used from middleware.

I think Ian's point is to standardise on a form key and on the interface of
the form object. Your point is valid that middleware should not
destructively read the wsgi.input variable.

Many web applications will at some point call other web applications. It
seems positively wasteful to have to clone and parse wsgi.input over and
over again. It makes sense to do it once, in middleware, and then stuff it
in a standard place in the wsgi environ.

Would you +1 the proposal if it is added that middleware does not destroy
the wsgi.input variable but clones it?

Regards,

Hans Then



More information about the Web-SIG mailing list