From 41ab31532f47bf94d69b0ea263b48495267d992b Mon Sep 17 00:00:00 2001 From: David Redmin Date: Mon, 8 Apr 2024 10:25:23 -0400 Subject: [PATCH 1/8] Bump version from 1.6.0 to 1.7.0 --- cyhy/mailer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyhy/mailer/__init__.py b/cyhy/mailer/__init__.py index 2691592..a78c7cd 100644 --- a/cyhy/mailer/__init__.py +++ b/cyhy/mailer/__init__.py @@ -1,3 +1,3 @@ """This package contains the cyhy-mailer code.""" -__version__ = "1.6.0" +__version__ = "1.7.0" From 23892d03f2960946397b0388d8e1ea5723997595 Mon Sep 17 00:00:00 2001 From: David Redmin Date: Mon, 8 Apr 2024 10:25:44 -0400 Subject: [PATCH 2/8] Bump version from 1.7.0 to 1.7.0-rc.1 --- cyhy/mailer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyhy/mailer/__init__.py b/cyhy/mailer/__init__.py index a78c7cd..7fba6fc 100644 --- a/cyhy/mailer/__init__.py +++ b/cyhy/mailer/__init__.py @@ -1,3 +1,3 @@ """This package contains the cyhy-mailer code.""" -__version__ = "1.7.0" +__version__ = "1.7.0-rc.1" From 4895fd61f394483cc262dc2c6d8723c16c5ab51e Mon Sep 17 00:00:00 2001 From: David Redmin Date: Mon, 8 Apr 2024 10:55:12 -0400 Subject: [PATCH 3/8] Limit CSA BCC functionality to non-federal and non-international entities --- cyhy/mailer/cli.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cyhy/mailer/cli.py b/cyhy/mailer/cli.py index d4afba9..fc4cb51 100755 --- a/cyhy/mailer/cli.py +++ b/cyhy/mailer/cli.py @@ -226,6 +226,7 @@ def get_requests_raw(db, query, batch_size=None): "agency.contacts.name": True, "agency.contacts.type": True, "agency.location.state": True, + "agency.type": True, } try: @@ -793,9 +794,13 @@ def send_cyhy_reports( if not to_emails: continue - # Grab the email address of the appropriate CSA. + # Grab the email address of the appropriate CSA for non-Federal and + # non-International entities. csa_email_address = None - if csa_emails is not None: + if csa_emails is not None and request["agency"].get("type") not in [ + "FEDERAL", + "INTERNATIONAL", + ]: try: state = request["agency"]["location"]["state"] except KeyError: @@ -1015,9 +1020,13 @@ def send_cyhy_notifications( if not to_emails: continue - # Grab the email address of the appropriate CSA. + # Grab the email address of the appropriate CSA for non-Federal and + # non-International entities. csa_email_address = None - if csa_emails is not None: + if csa_emails is not None and request["agency"].get("type") not in [ + "FEDERAL", + "INTERNATIONAL", + ]: try: state = request["agency"]["location"]["state"] except KeyError: From fed5e92ca8d37bbc85506b4a0f594de59936797c Mon Sep 17 00:00:00 2001 From: David Redmin Date: Mon, 8 Apr 2024 10:56:27 -0400 Subject: [PATCH 4/8] Update documentation to show that CSA BCC does not apply to federal or international entities --- README.md | 3 ++- cyhy/mailer/cli.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 056cc49..b48427d 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,8 @@ Options: present then the appropriate CSA will be BCCd any CyHy reports or notifications related to a - stakeholder within their region. + stakeholder within their region (federal + and international entities excluded). --batch-size=SIZE The batch size to use when retrieving results from the Mongo database. If not present then the default Mongo batch size diff --git a/cyhy/mailer/cli.py b/cyhy/mailer/cli.py index fc4cb51..6610209 100755 --- a/cyhy/mailer/cli.py +++ b/cyhy/mailer/cli.py @@ -51,7 +51,8 @@ present then the appropriate CSA will be BCCd any CyHy reports or notifications related to a - stakeholder within their region. + stakeholder within their region (federal + and international entities excluded). --batch-size=SIZE The batch size to use when retrieving results from the Mongo database. If not present then the default Mongo batch size @@ -747,8 +748,8 @@ def send_cyhy_reports( Either None or a dict with keys belonging to the set of two-letter abbreviations for states and territories and values equal to the email of the corresponding CSA for the region to - which the state or territory belongs. If None then the CSAs - will not be BCCd. + which the state or territory belongs (federal and international + entities excluded). If None then the CSAs will not be BCCd. dry_run : bool If True then do not actually send email. From 2895aafde49529dcdcc5cc0f1ae48360df9e8a36 Mon Sep 17 00:00:00 2001 From: David Redmin Date: Mon, 8 Apr 2024 16:29:34 -0400 Subject: [PATCH 5/8] Use a constant for list of CSA BCC excluded entity types --- cyhy/mailer/cli.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cyhy/mailer/cli.py b/cyhy/mailer/cli.py index 6610209..ef36100 100755 --- a/cyhy/mailer/cli.py +++ b/cyhy/mailer/cli.py @@ -92,6 +92,8 @@ from cyhy.mailer.TmailMessage import TmailMessage from mongo_db_from_config import db_from_config +CSA_BCC_EXCLUDED_ENTITY_TYPES = ["FEDERAL", "INTERNATIONAL"] + class Error(Exception): """A base class for exceptions used in this module.""" @@ -798,10 +800,10 @@ def send_cyhy_reports( # Grab the email address of the appropriate CSA for non-Federal and # non-International entities. csa_email_address = None - if csa_emails is not None and request["agency"].get("type") not in [ - "FEDERAL", - "INTERNATIONAL", - ]: + if ( + csa_emails is not None + and request["agency"].get("type") not in CSA_BCC_EXCLUDED_ENTITY_TYPES + ): try: state = request["agency"]["location"]["state"] except KeyError: @@ -1024,10 +1026,10 @@ def send_cyhy_notifications( # Grab the email address of the appropriate CSA for non-Federal and # non-International entities. csa_email_address = None - if csa_emails is not None and request["agency"].get("type") not in [ - "FEDERAL", - "INTERNATIONAL", - ]: + if ( + csa_emails is not None + and request["agency"].get("type") not in CSA_BCC_EXCLUDED_ENTITY_TYPES + ): try: state = request["agency"]["location"]["state"] except KeyError: From 91d38610416f7414e015cbb405b5f653be30e60c Mon Sep 17 00:00:00 2001 From: David Redmin Date: Mon, 8 Apr 2024 16:30:10 -0400 Subject: [PATCH 6/8] Bump version from 1.7.0-rc.1 to 1.7.0-rc.2 --- cyhy/mailer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyhy/mailer/__init__.py b/cyhy/mailer/__init__.py index 7fba6fc..3e2f81a 100644 --- a/cyhy/mailer/__init__.py +++ b/cyhy/mailer/__init__.py @@ -1,3 +1,3 @@ """This package contains the cyhy-mailer code.""" -__version__ = "1.7.0-rc.1" +__version__ = "1.7.0-rc.2" From ae293d0cb6f5086b566d72d9b148afce647b5454 Mon Sep 17 00:00:00 2001 From: dav3r Date: Tue, 9 Apr 2024 09:28:23 -0400 Subject: [PATCH 7/8] Remove unnecessary capitalization Co-authored-by: Nick <50747025+mcdonnnj@users.noreply.github.com> --- cyhy/mailer/cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cyhy/mailer/cli.py b/cyhy/mailer/cli.py index ef36100..857ad08 100755 --- a/cyhy/mailer/cli.py +++ b/cyhy/mailer/cli.py @@ -797,8 +797,8 @@ def send_cyhy_reports( if not to_emails: continue - # Grab the email address of the appropriate CSA for non-Federal and - # non-International entities. + # Grab the email address of the appropriate CSA for non-federal and + # non-international entities. csa_email_address = None if ( csa_emails is not None @@ -1023,8 +1023,8 @@ def send_cyhy_notifications( if not to_emails: continue - # Grab the email address of the appropriate CSA for non-Federal and - # non-International entities. + # Grab the email address of the appropriate CSA for non-federal and + # non-international entities. csa_email_address = None if ( csa_emails is not None From 8e45028d84c185e11ea91602d404c8c5a598e26d Mon Sep 17 00:00:00 2001 From: David Redmin Date: Tue, 9 Apr 2024 09:44:59 -0400 Subject: [PATCH 8/8] Bump version from 1.7.0-rc.2 to 1.7.0 --- cyhy/mailer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyhy/mailer/__init__.py b/cyhy/mailer/__init__.py index 3e2f81a..a78c7cd 100644 --- a/cyhy/mailer/__init__.py +++ b/cyhy/mailer/__init__.py @@ -1,3 +1,3 @@ """This package contains the cyhy-mailer code.""" -__version__ = "1.7.0-rc.2" +__version__ = "1.7.0"