From 0e187f85b7f2708a312332cf5755162624d1ff04 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 18 Jul 2019 15:08:12 -0400 Subject: [PATCH] Only attempt to use the parent's CONTENT_GATING_PARTITION settings if there is actually a parent --- openedx/features/content_type_gating/field_override.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openedx/features/content_type_gating/field_override.py b/openedx/features/content_type_gating/field_override.py index b028567091..23a101620a 100644 --- a/openedx/features/content_type_gating/field_override.py +++ b/openedx/features/content_type_gating/field_override.py @@ -52,9 +52,11 @@ class ContentTypeGatingFieldOverride(FieldOverrideProvider): # For Feature Based Enrollments, we want to inherit group access configurations # from parent blocks. The use case is to allow granting access # to all graded problems in a unit at the unit level - merged_group_access = block.get_parent().merged_group_access - if merged_group_access and CONTENT_GATING_PARTITION_ID in merged_group_access: - return original_group_access + parent = block.get_parent() + if parent is not None: + merged_group_access = parent.merged_group_access + if merged_group_access and CONTENT_GATING_PARTITION_ID in merged_group_access: + return original_group_access original_group_access.setdefault( CONTENT_GATING_PARTITION_ID,