misc: use general from in traceback emails (#50954)
This commit is contained in:
parent
5d03ea1f89
commit
2f012a4ae7
|
@ -2367,6 +2367,7 @@ def test_backoffice_wscall_on_error(http_requests, pub, emails, notify_on_errors
|
|||
return
|
||||
|
||||
pub.cfg['debug'] = {'error_email': 'errors@localhost.invalid'}
|
||||
pub.cfg['emails'] = {'from': 'from@localhost.invalid'}
|
||||
pub.write_cfg()
|
||||
|
||||
create_user(pub)
|
||||
|
@ -2421,6 +2422,8 @@ def test_backoffice_wscall_on_error(http_requests, pub, emails, notify_on_errors
|
|||
'[ERROR] [WSCALL] json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)'
|
||||
)
|
||||
assert '/form-title/%s/' % number31.id in error_email['payload']
|
||||
assert error_email['from'] == 'from@localhost.invalid'
|
||||
assert error_email['email_rcpt'] == ['errors@localhost.invalid']
|
||||
if record_on_errors:
|
||||
assert error_email['msg']['References']
|
||||
else:
|
||||
|
|
|
@ -33,10 +33,11 @@ class ApplicationLogger(DefaultLogger):
|
|||
headers = {}
|
||||
if tech_id:
|
||||
headers['References'] = '<%s@%s>' % (tech_id, os.path.basename(get_publisher().app_dir))
|
||||
email_from = getattr(self, 'error_email_from', None) or self.error_email
|
||||
email(
|
||||
subject='[ERROR] %s' % error_summary,
|
||||
mail_body=error_msg,
|
||||
email_from=self.error_email,
|
||||
email_from=email_from,
|
||||
email_rcpt=[self.error_email],
|
||||
want_html=False,
|
||||
fire_and_forget=True,
|
||||
|
|
|
@ -415,6 +415,7 @@ class QommonPublisher(Publisher, object):
|
|||
self.site_options = None # reset at the beginning of a request
|
||||
debug_cfg = self.cfg.get('debug', {})
|
||||
self.logger.error_email = debug_cfg.get('error_email')
|
||||
self.logger.error_email_from = self.cfg.get('emails', {}).get('from')
|
||||
self.config.display_exceptions = debug_cfg.get('display_exceptions')
|
||||
self.config.form_tokens = True
|
||||
self.config.session_cookie_httponly = True
|
||||
|
|
Loading…
Reference in New Issue