forked from CGM_Public/pretix_original
SMTP settings: Timeout during testing
This commit is contained in:
@@ -528,7 +528,7 @@ class Event(EventMixin, LoggedModel):
|
|||||||
|
|
||||||
return locking.LockManager(self)
|
return locking.LockManager(self)
|
||||||
|
|
||||||
def get_mail_backend(self, force_custom=False):
|
def get_mail_backend(self, timeout=None, force_custom=False):
|
||||||
"""
|
"""
|
||||||
Returns an email server connection, either by using the system-wide connection
|
Returns an email server connection, either by using the system-wide connection
|
||||||
or by returning a custom one based on the event's settings.
|
or by returning a custom one based on the event's settings.
|
||||||
@@ -542,7 +542,7 @@ class Event(EventMixin, LoggedModel):
|
|||||||
password=self.settings.smtp_password,
|
password=self.settings.smtp_password,
|
||||||
use_tls=self.settings.smtp_use_tls,
|
use_tls=self.settings.smtp_use_tls,
|
||||||
use_ssl=self.settings.smtp_use_ssl,
|
use_ssl=self.settings.smtp_use_ssl,
|
||||||
fail_silently=False)
|
fail_silently=False, timeout=timeout)
|
||||||
else:
|
else:
|
||||||
return get_connection(fail_silently=False)
|
return get_connection(fail_silently=False)
|
||||||
|
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ class MailSettings(EventSettingsViewMixin, EventSettingsFormView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if request.POST.get('test', '0').strip() == '1':
|
if request.POST.get('test', '0').strip() == '1':
|
||||||
backend = self.request.event.get_mail_backend(force_custom=True)
|
backend = self.request.event.get_mail_backend(force_custom=True, timeout=10)
|
||||||
try:
|
try:
|
||||||
backend.test(self.request.event.settings.mail_from)
|
backend.test(self.request.event.settings.mail_from)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user