Because I went so long without updating mod_wsgi, it was never brought inline with what the updated PEP 3333 said about Python 3 and WSGI. What I originally implemented and I proposed for Python 3 support for WSGI was a bit more forgiving in allowing the return of Unicode strings where bytes could be returned, so long as the Unicode string could be converted to bytes as Latin-1. That idea was never accepted and PEP 3333 only allows bytes for response content. The recent mod_wsgi updates are thus more strict and adhere to PEP 3333 properly.
Graham On 23/06/2014, at 11:00 PM, Jason Garber <[email protected]> wrote: > Hi Graham, > > When the IUS RPM upgrade hit our server Saturday, we started getting 500 > Internal Server Errors. The upgrade was from > > python33-mod_wsgi-3.4-2.ius.el6.x86_64 > to > python33-mod_wsgi-4.1.3-1.ius.el6.x86_64 > > The error was: > mod_wsgi (pid=1427): Exception occurred processing WSGI script > /home/deploy/WhiteBoot4/DevLevel.1/TMTManage/Web/Dashboard/User/index.wsgi'. > TypeError: sequence of byte string values expected, value of type str found > > -- > I investigated and found some 4-5 year old code that did this (preparing for > the wsgi response): > > self.Header['Content-Type'] = 'text/html' > self.Status = 302 > self.Iterator = ("",) > self.Length = 0 > > This was changed to: > > ... > self.Iterator = (b'',) > > Which of course fixed the problem. In more recent application code, there > was no problem because all responses were in bytes regardless of the response > status. > > -- > I'm not sure why we were returning an empty string on a 302 redirect, but I > thought it might be worth mentioning that something recently changed in > mod_wsgi which will cause a failure on this non-standard behavior. > > If this change was not intentional, I thought you might want to know Graham. > > Thanks! > Jason Garber > > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
