mirror of
https://github.com/django/django.git
synced 2025-12-09 02:55:57 +00:00
parent
f8bb8436e5
commit
1101467ce0
112 changed files with 1239 additions and 412 deletions
|
|
@ -22,13 +22,17 @@ class EmailBackend(ConsoleEmailBackend):
|
|||
self.file_path = os.path.abspath(self.file_path)
|
||||
# Make sure that self.file_path is an directory if it exists.
|
||||
if os.path.exists(self.file_path) and not os.path.isdir(self.file_path):
|
||||
raise ImproperlyConfigured('Path for saving email messages exists, but is not a directory: %s' % self.file_path)
|
||||
raise ImproperlyConfigured(
|
||||
'Path for saving email messages exists, but is not a directory: %s' % self.file_path
|
||||
)
|
||||
# Try to create it, if it not exists.
|
||||
elif not os.path.exists(self.file_path):
|
||||
try:
|
||||
os.makedirs(self.file_path)
|
||||
except OSError as err:
|
||||
raise ImproperlyConfigured('Could not create directory for saving email messages: %s (%s)' % (self.file_path, err))
|
||||
raise ImproperlyConfigured(
|
||||
'Could not create directory for saving email messages: %s (%s)' % (self.file_path, err)
|
||||
)
|
||||
# Make sure that self.file_path is writable.
|
||||
if not os.access(self.file_path, os.W_OK):
|
||||
raise ImproperlyConfigured('Could not write to directory: %s' % self.file_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue