mirror of
https://github.com/django/django.git
synced 2025-12-05 01:21:35 +00:00
Changed console and filebackend to use msg.as_bytes to output the data as it would get send via smtp.
This commit is contained in:
parent
5dfd824d38
commit
c988745cca
3 changed files with 33 additions and 24 deletions
|
|
@ -38,6 +38,11 @@ class EmailBackend(ConsoleEmailBackend):
|
|||
kwargs['stream'] = None
|
||||
super(EmailBackend, self).__init__(*args, **kwargs)
|
||||
|
||||
def write_message(self, message):
|
||||
self.stream.write(message.message().as_bytes() + b'\n')
|
||||
self.stream.write(b'-' * 79)
|
||||
self.stream.write(b'\n')
|
||||
|
||||
def _get_filename(self):
|
||||
"""Return a unique file name."""
|
||||
if self._fname is None:
|
||||
|
|
@ -48,7 +53,7 @@ class EmailBackend(ConsoleEmailBackend):
|
|||
|
||||
def open(self):
|
||||
if self.stream is None:
|
||||
self.stream = open(self._get_filename(), 'a')
|
||||
self.stream = open(self._get_filename(), 'ab')
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue