sequence of byte string values expected, value of type unicode found
by default the encoding tool encodes only "text/*", so it may fail with
"application/xml" or ...
I filled a ticket about that some time ago:
https://bitbucket.org/cherrypy/cherrypy/issue/1123/responseencoder-replace-text_only-with
> On Monday, March 19, 2012 12:51:03 PM UTC-5, Derek Litz wrote:
>
> I provided a method to override the check_username_and_password
> method, and after doing so upon error I got.
>
> mod_wsgi (pid=7625): Exception occurred processing WSGI script
> TypeError: sequence of byte string values expected, value of type
> unicode found
>
> I tried using tools.encode.on: True and tools.encode.encoding:
> 'utf-8'
> in my conf, but that did not fix the problem.
>
> I noticed in the tool the response body was being set directly so I
> changed line 319 to:
>
> response.body = body
> response.body = body.encode('utf-8')
>
> and that fixed the problem.
>
> I noticed https://bitbucket.org/cherrypy/cherrypy/wiki/UpgradeTo32
> <https://bitbucket.org/cherrypy/cherrypy/wiki/UpgradeTo32>,
> which seems like it may be related. Perhaps someone with better
> comprehension of the matters could shed some light for me?
>
> 1) Why didn't using tools.encode in my configuration work? Is it
> because the tool is setting the response body directly?
> 2) Is this a bug, poor implementation (of the tool), or user error?
> 3) Is there a way for me to fix this problem I'm encountering,
> besides
> rewriting/overriding what I need to in the Session Auth tool?
>
> --
> You received this message because you are subscribed to the Google
> Groups "cherrypy-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cherrypy-users/-/IDLAc1slNS0J.
> To post to this group, send email to cherryp...@googlegroups.com.
> To unsubscribe from this group, send email to
> cherrypy-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cherrypy-users?hl=en.
Good catch. That function should probably fail loudly if it receives a non-native string arg. A ticket would be appreciated.
Robert Brewer
--
You received this message because you are subscribed to the Google Groups
"cherrypy-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cherrypy-users/-/VT6BM4TJhbsJ.