From c3ad168b10ebb47af1ca531b3b7fd005af9d34cc Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Thu, 11 Jul 2013 12:12:42 -0400 Subject: [PATCH] also add some defaulting to the querying of the settings where it defaults to an empty set --- common/djangoapps/util/sandboxing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/util/sandboxing.py b/common/djangoapps/util/sandboxing.py index 7d1c1da06f..2024f8fa27 100644 --- a/common/djangoapps/util/sandboxing.py +++ b/common/djangoapps/util/sandboxing.py @@ -14,7 +14,9 @@ def can_execute_unsafe_code(course_id): """ # To decide if we can run unsafe code, we check the course id against # a list of regexes configured on the server. - for regex in settings.COURSES_WITH_UNSAFE_CODE: + # If this is not defined in the environment variables then default to the most restrictive, which + # is 'no unsafe courses' + for regex in getattr(settings, 'COURSES_WITH_UNSAFE_CODE', []): if re.match(regex, course_id): return True return False