From 751e60864b349166bd3b57e53e790da012354f36 Mon Sep 17 00:00:00 2001 From: zaihuaji Date: Fri, 5 Sep 2025 10:25:45 -0500 Subject: [PATCH] skip cc email for rcrqst.ccemail = 'N' --- pyproject.toml | 2 +- src/rda_python_common/PgLOG.py | 7 ++++--- src/rda_python_common/PgOPT.py | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 00c6c2f..6e4b105 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "rda_python_common" -version = "1.0.37" +version = "1.0.38" authors = [ { name="Zaihua Ji", email="zji@ucar.edu" }, ] diff --git a/src/rda_python_common/PgLOG.py b/src/rda_python_common/PgLOG.py index 9948a3c..9d15540 100644 --- a/src/rda_python_common/PgLOG.py +++ b/src/rda_python_common/PgLOG.py @@ -251,7 +251,7 @@ def send_customized_email(logmsg, emlmsg, logact = 0): entries = { 'fr' : ["From", 1, None], 'to' : ["To", 1, None], - 'cc' : ["Cc", 0, None], + 'cc' : ["Cc", 0, ''], 'sb' : ["Subject", 1, None] } @@ -293,7 +293,8 @@ def send_email(subject = None, receiver = None, msg = None, sender = None, logac return send_python_email(subject, receiver, msg, sender, None, logact) # -# send an email via python module smtplib; if empty msg send email message saved in PGLOG['EMLMSG'] instead +# send an email via python module smtplib; if empty msg send email message saved +# in PGLOG['EMLMSG'] instead. pass cc = '' for skipping 'Cc: ' # def send_python_email(subject = None, receiver = None, msg = None, sender = None, cc = None, logact = 0): @@ -321,7 +322,7 @@ def send_python_email(subject = None, receiver = None, msg = None, sender = None emlmsg['From'] = sender emlmsg['To'] = receiver logmsg = "Email " + receiver - if not cc: cc = PGLOG['CCDADDR'] + if cc == None: cc = PGLOG['CCDADDR'] if cc: emlmsg['Cc'] = cc logmsg += " Cc'd " + cc diff --git a/src/rda_python_common/PgOPT.py b/src/rda_python_common/PgOPT.py index f2878d3..4d36bc0 100644 --- a/src/rda_python_common/PgOPT.py +++ b/src/rda_python_common/PgOPT.py @@ -1682,8 +1682,10 @@ def send_request_email_notice(pgrqst, errmsg, fcount, rstat, readyfile = None, p einfo['GLOBUS_TASK_URL'] = "https://app.globus.org/activity/" + pgrqst['task_id'] for ekey in einfo: - ebuf = re.sub(r'<{}>'.format(ekey), einfo[ekey], ebuf) - + if ekey == 'CCD' and not einfo['CCD']: + ebuf = re.sub(r'Cc:\s*\s*', '', ebuf) + else: + ebuf = re.sub(r'<{}>'.format(ekey), einfo[ekey], ebuf) if PgLOG.PGLOG['DSCHECK'] and not pgpart: tbl = "dscheck"