PyISAPIe cannot pass WebOb dict type check

23 de afișări
Accesați primul mesaj necitit

Yap Sok Ann

necitită,
24 oct. 2011, 07:12:1424.10.2011
– PyISAPIe
This change in WebOb:

if type(environ) is not dict:
raise TypeError("WSGI environ must be a dict")

( https://github.com/Pylons/webob/commit/fa3834b1ed35cc7cf8e43fc6bde4dd4ff4df30bd#L4R48
)

somehow doesn't work with PyISAPIe. If I change the if-statement to:

if isinstance(environ, dict):

then it works fine.

Is it an expected behavior, or is there something wrong with my setup?
Thanks.

Yap Sok Ann

necitită,
24 oct. 2011, 07:18:0724.10.2011
– PyISAPIe
Ah, nevermind. Just saw that PyISAPIe is using IsapiEnv, a subclass of
dict. I should check with the WebOb guys to change the if-statement to
use isinstance instead.

On Oct 24, 7:12 pm, Yap Sok Ann <sok...@gmail.com> wrote:
> This change in WebOb:
>
>     if type(environ) is not dict:
>         raise TypeError("WSGI environ must be a dict")
>
> (https://github.com/Pylons/webob/commit/fa3834b1ed35cc7cf8e43fc6bde4dd...

Yap Sok Ann

necitită,
24 oct. 2011, 07:28:4024.10.2011
– PyISAPIe
From http://www.python.org/dev/peps/pep-3333/

> The environ parameter is a dictionary object, containing CGI-style environment variables. This object must be a builtin Python dictionary (not a subclass, UserDict or other dictionary emulation)

Looks like the "proper" solution is to change this line in PyISAPIe/
Python/Http/WSGI.py from:

Environ = IsapiEnv(Base, EnvWSGI)

to

Environ = dict(IsapiEnv(Base, EnvWSGI))

though I am not sure if it will cause any breakage...

Phillip Sitbon

necitită,
15 nov. 2011, 17:17:3015.11.2011
– pyis...@googlegroups.com
Just to follow up:

It's not a big deal, the whole point of creating that dictionary proxy
was to avoid such issues. WebOb should be using isinstance(), because
it would then see that IsapiEnv is an instance of type dict.

Cheers,

Phillip

> --
> You received this message because you are subscribed to the Google Groups "PyISAPIe" group.
> To post to this group, send email to pyis...@googlegroups.com.
> To unsubscribe from this group, send email to pyisapie+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyisapie?hl=en.
>
>

Răspundeți tuturor
Răspundeți autorului
Redirecționați
0 mesaje noi