Fortunately I can debug all three with PyDev (awesome!) and this is the
first time I've had to remotely debug the live site, as it was crashing
when users attempt to reset their passwords. it crashed here:
and it did so because {{{self.stream}}} at this point, on the live server
was of type {{{BufferedWriter}}} while on the sandbox and dev sites it is
of type {{{TextIOWrapper}}}.
The latter take strings, and is fed a string at this line. Alas the former
does not, it only takes byte strings.
I have no idea how or why these sites deviate in self.stream here, or
whence that stemeth. I would like to know, but that would a research
project I lack time for in the urgent need to get this site live.
So I patched that method and it now reads:
{{{
def write_message(self, message):
#import pydevd; pydevd.settrace('192.168.0.11',
stdoutToServer=True, stderrToServer=True)
msg = message.message()
msg_data = msg.as_bytes()
charset = msg.get_charset().get_output_charset() if
msg.get_charset() else 'utf-8'
if self.stream.mode.endswith('b'):
self.stream.write(msg_data)
self.stream.write(b'\n')
self.stream.write(b'-' * 79)
self.stream.write(b'\n')
else:
msg_data = msg_data.decode(charset)
self.stream.write('%s\n' % msg_data)
self.stream.write('-' * 79)
self.stream.write('\n')
}}}
(you can see my breakpoint in the pydev debugger commented out there)
There are two distinct issues here:
1. How is it possible that self.stream is set to an incompatible type?
2. This method should really be more robust (as pictured) anyhow ...
--
Ticket URL: <https://code.djangoproject.com/ticket/33150>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
* component: Uncategorized => Core (Mail)
Comment:
Thanks for the report, however it looks like a support question and Trac
is not one of
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels]. Moreover the console backend is not intended for use in
production -- it is provided as a convenience that can be used during
development (see [https://docs.djangoproject.com/en/stable/topics/email
/#console-backend docs]).
--
Ticket URL: <https://code.djangoproject.com/ticket/33150#comment:1>