1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Refs #29983 -- Added pathlib.Path support to the file email backend.

This commit is contained in:
Jon Dufresne
2019-11-06 00:33:07 -08:00
committed by Carlton Gibson
parent 422b875c65
commit fbbff7f808
5 changed files with 25 additions and 5 deletions

View File

@@ -17,9 +17,6 @@ class EmailBackend(ConsoleEmailBackend):
self.file_path = file_path
else:
self.file_path = getattr(settings, 'EMAIL_FILE_PATH', None)
# Make sure self.file_path is a string.
if not isinstance(self.file_path, str):
raise ImproperlyConfigured('Path for saving emails is invalid: %r' % self.file_path)
self.file_path = os.path.abspath(self.file_path)
try:
os.makedirs(self.file_path, exist_ok=True)