Don't use an empty dict as default value for argument of function. There is
literally one of them only and it will be shared across all calls.

Use None as default value and have function check to see if value 'is None'
and if so replace it with empty dict inside of function.

Graham

On Tuesday, 6 December 2011, Garito <[email protected]> wrote:
> Hi!
> I'm trying to process the content of the wsgi.input stream and I
> realize that 2 different request mixes the content of the form (I can
> see the both forms's content in the 2nd call)
>
> Did you know why is that?
>
> This is the related code I'm using:
>
> if environ['REQUEST_METHOD'] == 'POST' and 'CONTENT_TYPE' in environ:
>                        datos = self.procesaFormulario(FieldStorage(fp =
> environ['wsgi.input'], environ = environ, keep_blank_values = 1))
>
> def procesaFormulario(self, datos, resultado = {}):
>                for campo in datos:
>                        if type(datos[campo]) == type([]):
>                                nombre = campo[:-2]
>                                valor = []
>                                for elemento in datos[campo]:
>                                        if hasattr(elemento, 'filename'):
> valor.append({elemento.filename: elemento.value})
>                                        else:
valor.append(datos[campo].value)
>                        else:
>                                nombre = campo
>                                if hasattr(datos[campo], 'filename'):
valor =
> {datos[campo].filename: datos[campo].value}
>                                else: valor = datos[campo].value
>                        resultado[nombre] = valor
>                return resultado
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
"modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
[email protected].
> For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to