You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/03/13 22:57:15 UTC
[airavata-django-portal] 02/02: Make PORTAL_ADMINS optional,
defaulting to ADMINS
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 4acb1708645dc6d6a19908e7282d97f78a34239b
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Mar 13 18:56:42 2020 -0400
Make PORTAL_ADMINS optional, defaulting to ADMINS
---
django_airavata/apps/auth/utils.py | 8 ++++++--
django_airavata/settings_local.py.sample | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/django_airavata/apps/auth/utils.py b/django_airavata/apps/auth/utils.py
index 0c35a3b..abef379 100644
--- a/django_airavata/apps/auth/utils.py
+++ b/django_airavata/apps/auth/utils.py
@@ -97,7 +97,9 @@ def send_new_user_email(request, username, email, first_name, last_name):
from_email="{} <{}>".format(
settings.PORTAL_TITLE,
settings.SERVER_EMAIL),
- to=[a[1] for a in settings.PORTAL_ADMINS])
+ to=[a[1] for a in getattr(settings,
+ 'PORTAL_ADMINS',
+ settings.ADMINS)])
msg.content_subtype = 'html'
msg.send()
@@ -114,7 +116,9 @@ def send_email_to_user(template_id, context):
to=["\"{} {}\" <{}>".format(context['first_name'],
context['last_name'],
context['email'])],
- reply_to=[f"\"{a[0]}\" <{a[1]}>" for a in settings.PORTAL_ADMINS]
+ reply_to=[f"\"{a[0]}\" <{a[1]}>" for a in getattr(settings,
+ 'PORTAL_ADMINS',
+ settings.ADMINS)]
)
msg.content_subtype = 'html'
msg.send()
diff --git a/django_airavata/settings_local.py.sample b/django_airavata/settings_local.py.sample
index da98351..037c3d1 100644
--- a/django_airavata/settings_local.py.sample
+++ b/django_airavata/settings_local.py.sample
@@ -43,9 +43,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# EMAIL_USE_TLS = True
# ADMINS receive error emails
# ADMINS = [('Admin Name', 'admin@example.com')]
-# PORTAL_ADMINS receive administrative emails, like when a new user is created
+# Optional: PORTAL_ADMINS receive administrative emails, like when a new user is created
# This can be set to a different value than ADMINS so that the PORTAL_ADMINS
-# don't receive error emails
+# don't receive error emails. Defaults to the same value as ADMINS.
# PORTAL_ADMINS = ADMINS
# SERVER_EMAIL = 'portal@example.com'