fix: handle AttributeError in exception clause (#36317)

This commit is contained in:
Muhammad Farhan
2025-03-04 13:05:04 +05:00
committed by GitHub
parent fd3a106ac4
commit 988801f3c0

View File

@@ -1562,7 +1562,7 @@ def _get_release_date(xblock, user=None):
reset_to_default = False
try:
reset_to_default = xblock.start.year < 1900
except ValueError:
except (ValueError, AttributeError):
# For old mongo courses, accessing the start attribute calls `to_json()`,
# which raises a `ValueError` for years < 1900.
reset_to_default = True