From e26205b2168a3ce7201dd4ddfc8528a34d5ae01f Mon Sep 17 00:00:00 2001 From: John Nagro Date: Tue, 23 Jan 2024 15:57:32 -0500 Subject: [PATCH] fix: guard against null content_filters (#1999) --- CHANGELOG.rst | 6 ++++++ enterprise/__init__.py | 2 +- .../commands/add_exec_ed_exclusion_to_catalogs.py | 11 +++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 29aa8547f1..da50c4a3c9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,12 @@ Change Log Unreleased ---------- +[4.10.8] +-------- + +fix: guard against null content_filters + + [4.10.7] -------- diff --git a/enterprise/__init__.py b/enterprise/__init__.py index face05c6ba..52d07213bd 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.10.7" +__version__ = "4.10.8" diff --git a/enterprise/management/commands/add_exec_ed_exclusion_to_catalogs.py b/enterprise/management/commands/add_exec_ed_exclusion_to_catalogs.py index 77f6144091..62c9d63628 100644 --- a/enterprise/management/commands/add_exec_ed_exclusion_to_catalogs.py +++ b/enterprise/management/commands/add_exec_ed_exclusion_to_catalogs.py @@ -57,10 +57,17 @@ def handle(self, *args, **options): f'updated query {catalog_query.id}' ) - for cusrtomer_catalog_batch in batch_by_pk(EnterpriseCustomerCatalog): - for customer_catalog in cusrtomer_catalog_batch: + for customer_catalog_batch in batch_by_pk(EnterpriseCustomerCatalog): + for customer_catalog in customer_catalog_batch: logger.info(f'{customer_catalog.uuid}') + if customer_catalog.content_filter is None: + logger.info( + 'add_exec_ed_exclusion_to_catalogs ' + f'catalog {customer_catalog.uuid} has no content_filter' + ) + continue + if customer_catalog.content_filter.get('course_type__exclude'): logger.info( 'add_exec_ed_exclusion_to_catalogs '