I've been updating my session library to utilize typing/mypy and this 
implementation detail surfaced between mypy integration and some new tests.

I hope someone can enlighten me on this and some best testing practices...

Webob's SignedSerializer expects to dump to, and load from, `bytes`.  The 
default behavior is handled by taking json.dumps/loads - which operates on 
strings - and transcoding it between bytes and string. 
(See https://github.com/Pylons/webob/blob/main/src/webob/cookies.py)

Webob's set_cookie is designed to accept strings, and transcodes it to 
bytes with utf8 encoding.
(https://github.com/Pylons/webob/blob/main/src/webob/response.py)

Webob's request does a lot of transcoding between bytes and str for the 
cookies, and both utf8 and latin1 charsets are used.

Can anyone share why these design decisions were made?  There just seems to 
be a lot of needless transcoding going around, and the design decisions in 
webob/pyramid tend to be very deliberate and thought out - so I must be 
missing something.  

Can anyone also share exactly why there are some latin-1 charsets in the 
webob cookie logic?

Thank you in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/c2c36996-39c3-434a-91a9-a77bb2343027n%40googlegroups.com.

Reply via email to