add an email prefix in configuration

This commit is contained in:
Jérôme Schneider 2013-10-31 12:10:10 +01:00
parent 50e0957177
commit 6f21e0519e
3 changed files with 4 additions and 13 deletions

View File

@ -25,7 +25,7 @@ class Email:
logger.warning('[Config] Send email %s failed: bad configuration' % msg)
# build email
msg = MIMEText(msg, type)
msg['Subject'] = subject
msg['Subject'] = config.email_prefix + subject
msg['From'] = config.email_from
msg['To'] = ', '.join(config.email_to)
# sent email

View File

@ -43,6 +43,7 @@ data_dir = os.path.join(_PROJECT_PATH, 'data')
# Email notification configuration
email_notification = False
email_prefix='[Mandaye]'
smtp_host = 'localhost'
smtp_port = 25
email_from = 'traceback@entrouvert.com'
@ -61,17 +62,7 @@ encrypt_sp_password = False
# Must be a 16, 24, or 32 bytes long
encrypt_secret = ''
hosts = {
'linuxfr.local:8000': [
{'path': r'/',
'target': 'http://linuxfr.org',
'mapping': 'mandaye.configs.linuxfr_saml_example.linuxfr_mapping'
},
{ 'path': r'/static',
'static': static_root
}
],
}
hosts = {}
alembic_cfg = os.path.join(_PROJECT_PATH, 'mandaye/alembic.ini')
alembic_script_path = os.path.join(_PROJECT_PATH, 'mandaye/alembic')

View File

@ -76,7 +76,7 @@ def _500(path, msg, exception=None, env=None):
tb_str = _get_traceback()
if email:
try:
email.sent('Mandaye internal server error %s' % exception,
email.sent('internal server error %s' % exception,
_get_text_error(tb_str, path, env=env))
except Exception as detail:
logger.warning('Sent mail failed with error: %s' % detail)